Last active
January 22, 2016 05:41
-
-
Save saihoooooooo/f6eb7661913636d0bb05 to your computer and use it in GitHub Desktop.
mongo update in document in array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.rooms.insert({_id: 1234567890, members: [{name: "hoge", age: 20}, {name: "fuga", age: 21}]}) | |
db.rooms.update({_id: 1234567890}, {$set: {"members.0.name": "piyo", "members.0.age": 18, "members.1.name": "rodorigesu", "members.1.age": 46}}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment