var mycollection = db.things.find({name:"foo"});
mycollection;
...gave me:
- { "_id" : ObjectId("4fe8c09ce4dada0af3bde933"), "name" : "foo", "other" : "bar" }
- { "_id" : ObjectId("4fe8c09ce4dada0af3bde934"), "name" : "foo", "other" : "baz" }
This updated the second record:
db.things.update( { other:"baz" }, { name:"foo", other:"baz", more:"qux" } );
Note that I had to respecify existing data points or they would be DROPPED from the object! When I reran the first two commands in this blog posting I got:
- { "_id" : ObjectId("4fe8c09ce4dada0af3bde933"), "name" : "foo", "other" : "bar" }
- { "_id" : ObjectId("4fe8c09ce4dada0af3bde934"), "name" : "foo", "other" : "baz", "more" : "qux" }
No comments:
Post a Comment