Skip to content

Instantly share code, notes, and snippets.

@arthurnn
Last active December 18, 2015 01:49
Show Gist options
  • Save arthurnn/5706565 to your computer and use it in GitHub Desktop.
Save arthurnn/5706565 to your computer and use it in GitHub Desktop.
mongodb ordered sub-doc
use test
db.entities.drop()
db.entities.insert({_id: 1})
db.entities.update({ "_id": 1 }, {"$set": {"foo": "foo"} })
db.entities.update({ "_id": 1 }, {"$set": {"a": "a"} })
db.entities.update({ "_id": 1 }, {"$set": {"c": "c"} })
db.entities.update({ "_id": 1 }, {"$set": {"b": "b"} })
db.entities.find()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment