Please can someone guide me as to how I can accomplish the below. I have a Banks document, that is embedded with child document "branches" which in turn has embedded documents "branchcontacts" . I am trying to query for branchContacts with whose designation is Manager.
What I get is the complete Bank document with both the child branchcontacts. How can I ensure the branchContacts with ONLY "Manager" designation are returned as part of the Bank document.
For eg: below when Bank document is returned I should not get branchcontacts for Lucy and Janet as their designation is Accountant.
{
"_id" : ObjectId("558e539941755bca3a966c10"),
"bankCode" : "B001",
"name" : "Progress Bank",
"city" : "Paris",
"branches" : [
{
"name" : "Standard-Gusto",
"address" : "address gusto",
"landLine1" : "343453453",
"mobile1" : "045865964",
"branchcontacts" : [
{
"contactName" : "Daniel",
"designation" : "Manager",
"emailID" : "dan...@prog.com",
"landLine1" : "3453453"
}
{
"contactName" : "Lucy",
"designation" : "Accounant",
"emailID" : "lu...@prog.com",
"landLine1" : "7443456"
}
]
}
{
"name" : "Standard-Pronto",
"address" : "address pronto",
"landLine1" : "763453453",
"mobile1" : "46585964",
"branchContacts" : [
{
"contactName" : "Mary",
"designation" : "Manager",
"emailID" : "ma...@prog.com",
"landLine1" : "8453453"
}
{
"contactName" : "Janet",
"designation" : "Accounant",
"emailID" : "ja...@prog.com",
"landLine1" : "9943456"
}
]
}
]
}
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/1043aa4b-4d17-4106-838d-64dd4c0981a4%40googlegroups.com.