Details
-
Bug
-
Resolution: Incomplete
-
Major - P3
-
None
-
None
-
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
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" :
,
"voted_at" : ISODate("2015-03-17T05:57:04.256Z")
},
{
"voter_name" : "manish",
"behaviour" :
,
"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" :
,
"voted_at" : ISODate("2015-03-17T06:01:39.845Z")
},
{
"voter_name" : "manish",
"behaviour" :
,
"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" :
,
"voted_at" : ISODate("2015-03-17T06:02:04.569Z")
},
{
"voter_name" : "atul",
"behaviour" :
,
"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 :
}
}
)
but the problem is I am getting only the first object occurence i.e
/* 0 */
{
"_id" : ObjectId("5507e544dea5ce8c8f6a568a"),
"vote_details" : [
{
"voter_name" : "manish",
"behaviour" :
,
"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?