I have a document in Mongo where by I would like to fetch based on certain criteria.
My LawCase document
{
"_id" : ObjectId("5945f88c9a89205aae0efe9a"),
"category" : "DUI",
"updated_at" : ISODate("2017-06-18T03:50:36.825+0000"),
"created_at" : ISODate("2017-06-18T03:50:36.821+0000"),
"lawyer_ids" : [
"5945f88c9a89205aae0efe99"
]
}
My Lawyer Document
{
"_id" : ObjectId("5945f88c9a89205aae0efea8"),
"full_name" : "Some Name ",
"active" : true,
"updated_at" : ISODate("2017-06-18T03:50:36.849+0000"),
"created_at" : ISODate("2017-06-18T03:50:36.849+0000"),
"law_case_ids" : [
"5945f88c9a89205aae0efea9",
"5945f88c9a89205aae0efeac",
"5945f8b59a89205aae0f3f81",
"5955d0ff9a89200a57340db8"
]
}
Assuming I have the data in place, I need to get 50 documents where category is 'DUI' and lawyer_id is unique.
Any tips?