Created
December 4, 2010 23:32
-
-
Save biilmann/728602 to your computer and use it in GitHub Desktop.
Anyway to get just one element in an embedded array?
This file contains hidden or 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.users.insert({"name": "Pepe", "projects": [{"id": "123", "role": 1}, {"id": "234", "role": 1}, {"id": "345", "role": 2}, ...]}); | |
| var user = db.find({"projects.id": "234"}); | |
| // Any way to get just: user: | |
| { | |
| "name": "Pepe", | |
| "projects": [{"id": "234", "role": 1}] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment