[DOCS-5028] Comment on: "about/support.txt" Created: 17/Mar/15  Updated: 03/Nov/17  Resolved: 17/Mar/15

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: 01112017-cleanup

Type: Bug Priority: Major - P3
Reporter: Docs Collector User (Inactive) Assignee: Unassigned
Resolution: Incomplete Votes: 0
Labels: collector-298ba4e7
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

ubuntu

Location: http://www.mongodb.org/about/support/
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36
Referrer: https://www.google.co.in/
Screen Resolution: 1366 x 768
repo: mongodb-www-about
source: support


Participants:
Days since reply: 7 years, 29 weeks ago

 Description   

I am practising mongodb in robomongo, I have created document (named "eetusers") with multiple array objects.

Here is my document:
db.eetusers.find()

'/* 0 */
{
"_id" : ObjectId("5507c230dea5ce8c8f6a5687"),
"name" : "Bharat",
"username" : "pbharatprdxn",
"email" : "bharat@*.com",
"vote_details" : [
{
"voter_name" : "atul",
"technical" :

{ "upvote" : 4 }

,
"voted_at" : ISODate("2015-03-17T05:57:04.256Z")
},
{
"voter_name" : "manish",
"behaviour" :

{ "downvote" : 4 }

,
"voted_at" : ISODate("2015-03-17T05:57:04.256Z")
}
],
"total_upvotes" : 4,
"total_downvotes" : 4
}

/* 1 */
{
"_id" : ObjectId("5507c343dea5ce8c8f6a5688"),
"name" : "Atul",
"username" : "natulprdxn",
"email" : "atul@*.com",
"vote_details" : [
{
"voter_name" : "bharat",
"technical" :

{ "upvote" : 5 }

,
"voted_at" : ISODate("2015-03-17T06:01:39.845Z")
},
{
"voter_name" : "manish",
"behaviour" :

{ "downvote" : 3 }

,
"voted_at" : ISODate("2015-03-17T06:01:39.845Z")
}
],
"total_upvotes" : 5,
"total_downvotes" : 3
}

/* 2 */
{
"_id" : ObjectId("5507c35cdea5ce8c8f6a5689"),
"name" : "Manish",
"username" : "kmanishprdxn",
"email" : "manish@*.com",
"vote_details" : [
{
"voter_name" : "bharat",
"technical" :

{ "upvote" : 5 }

,
"voted_at" : ISODate("2015-03-17T06:02:04.569Z")
},
{
"voter_name" : "atul",
"behaviour" :

{ "upvote" : 3 }

,
"voted_at" : ISODate("2015-03-17T06:02:04.569Z")
}
],
"total_upvotes" : 8
}

Now, I need to find all the objects in the document satisfying some condition, for that I used the following query:

db.eetusers.find(
//Criteria

{ name: 'Parag', 'vote_details.voter_name': 'manish'}

,
{
vote_details:
{
$elemMatch :

{ voter_name: 'manish' }


}
}
)

but the problem is I am getting only the first object occurence i.e

/* 0 */
{
"_id" : ObjectId("5507e544dea5ce8c8f6a568a"),
"vote_details" : [
{
"voter_name" : "manish",
"behaviour" :

{ "downvotes" : 4 }

,
"voted_at" : ISODate("2015-04-17T18:30:00.000Z")
}
]
}

I want all the occurences of "manish", so can you suggest the proper query to get the desired result?



 Comments   
Comment by Emily Hall [ 27/Jul/16 ]

Closed for housekeeping on 7/27/2016 by Emily Hall.
If you require additional support, please open a new ticket for prioritization.
Thanks,
Emily

Generated at Thu Feb 08 07:49:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.