Skip to content

Instantly share code, notes, and snippets.

@geoffeg
Created February 10, 2012 01:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geoffeg/1785380 to your computer and use it in GitHub Desktop.
Save geoffeg/1785380 to your computer and use it in GitHub Desktop.
initial mongodb fixed-array example
> db.searches.save(
{_id: 1,
"searches" : [
{"site" : "google", "q": "restaurants"},
{"site" : "yahoo", "q" : "shoes"},
{"site" : "bing", "q" : "cheap flights"}
]
}
)
> db.searches.update(
{_id : 1},
{ $pop: { "searches" : -1 },
$push : { "searches" : { "site" : "blekko.com", "q" : "mongodb" } }
}
)
Field name duplication not allowed with modifiers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment