Skip to content

Instantly share code, notes, and snippets.

@jonmagic
Created November 10, 2009 14:56
Show Gist options
  • Save jonmagic/230924 to your computer and use it in GitHub Desktop.
Save jonmagic/230924 to your computer and use it in GitHub Desktop.
# get some fruit!
orange = { "name": "Orange", "owners": [{ "Jon": 2 }, { "Steve": 5 }] }
apple = { "name": "Apple", "owners": [{ "Jon": 4 }, { "Bill": 2 }] }
pear = { "name": "Pear", "owners": [{ "Jon": 1 }, { "Tom": 3 }] }
# save the fruit
db.foo.save(orange)
db.foo.save(apple)
db.foo.save(pear)
# how do I find all fruit owned by Jon, and how much of that fruit he owns?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment