Document:
*User *collection
> {
> 'name': 'abc',
> "watch" : [
> {
> "cat_name" : "Satish",
> "cat_id" : "55ace5047f80b77017edsfa0e",
> "script" : {
> "script" : "SBIN",
> "exchange" : "NS"
> }
> },
> {
> "cat_name" : "Satish",
> "cat_id" : "55ace5047f8sdf7017ed8a0e",
> "script" : {
> "script" : "ITC",
> "exchange" : "NS"
> }
> },
> {
> "cat_name" : "technotip",
> "cat_id" : "55ace590htt0b77017ed8a10",
> "script" : {
> "script" : "SYNCOM",
> "exchange" : "NS"
> }
> }
> ]
> }
>
Now how can I fetch only the object cat_name = technotip
User.find({'name': 'abc'}, {});
This gets me the whole document. I only want the object which is inside key
'watch', with 'cat_name' as ''technotip'.
Please help.
If I had simple values inside the array I would have used comparison
operator <http://technotip.com/3031/comparison-operators-mongodb/> to fetch
the value, but in this case I have objects inside the array.
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/bdb5171e-0c48-434a-9afe-71f04bb703b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.