I am new to mongoDB . I have aware of some basic queries of mongoDb but not advanced. My document looks like following :
{
"_id" : ObjectId("5289deaa84aedcc100228259"),
"gender" : "male",
"intrest" : [
{
"userId" : ObjectId("5286294984ae18ac5d19af36"),
"timestamp" : ISODate("2013-11-18T09:32:38.040Z"),
"status" : "Pending"
},
{
"userId" : ObjectId("5286295984ae18ac5d19af37"),
"timestamp" : ISODate("2013-11-18T09:33:17.493Z"),
"status" : "Pending"
}
],
"intrestAccepted" : [ ],
"intrestCancled" : [ ],
"intrestDeclined" : [ ],
"intrestReceived" : [
ObjectId("5286294984ae18ac5d19af36"),
ObjectId("5286295984ae18ac5d19af37")
],
"owner" : ObjectId("5286293284ae18ac5d19af35"),
"postDesc" : "gggg",
"tags" : [
"ggg"
]
}
{
"_id" : ObjectId("5289dea084aedcc100228258"),
"gender" : "female",
"intrest" : [
{
"userId" : ObjectId("5286294984ae18ac5d19af36"),
"timestamp" : ISODate("2013-11-18T09:32:42.934Z"),
"status" : "Pending"
},
{
"userId" : ObjectId("5286295984ae18ac5d19af37"),
"timestamp" : ISODate("2013-11-18T09:33:18.520Z"),
"status" : "Pending"
}
],
"intrestAccepted" : [ ],
"intrestCancled" : [ ],
"intrestDeclined" : [ ],
"intrestReceived" : [
ObjectId("5286294984ae18ac5d19af36"),
ObjectId("5286295984ae18ac5d19af37")
],
"owner" : ObjectId("5286293284ae18ac5d19af35"),
"postDesc" : "asdf",
"tags" : [
"asdf"
]
}
{
"_id" : ObjectId("5289dec984aedcc10022825a"),
"gender" : "male",
"intrest" : [
{
"userId" : ObjectId("5286295984ae18ac5d19af37"),
"timestamp" : ISODate("2013-11-18T09:33:20.996Z"),
"status" : "Pending"
}
],
"intrestAccepted" : [ ],
"intrestCancled" : [ ],
"intrestDeclined" : [ ],
"intrestReceived" : [
ObjectId("5286295984ae18ac5d19af37")
],
"owner" : ObjectId("5286294984ae18ac5d19af36"),
"postDesc" : "fff",
"tags" : [
"fff"
]
}
I want to find totalcount for intrestReceived[] whose owner is ObjectId("5286293284ae18ac5d19af35")
What query am I supposed to write. Please help .