Wednesday, March 12, 2014

Mongo 2.4.9 - $inc

- db.products.find({for:'ac3'}).limit(1).pretty()

{
        "_id" : ObjectId("507d95d5719dbef170f15bf9"),
        "for" : [
                "ac3",
                "ac7",
                "ac9"
        ],
        "name" : "AC3 Series Charger",
        "price" : 21,
        "type" : [
                "accessory",
                "charger"
        ],
        "warranty_years" : 0.25
}

- db.products.update({for:'ac3'},{$inc:{price:2}},0,1)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.