Am using mongo to store my documents. And one of them looks like below.
Name:
first: joe
last: blo
address:
city: Paris
state: London
relatives:
first order:
aunt: ashley
uncle: tom
second order
aunt: roma
uncle: robin
I would like to be able to perform a query which would give me documents that match 'aunt':'roma'. Am using mongo java api to access it
From what I have understood and read the following query should work, but it doesnt
DBObject winner = new BasicDBObject("$match", new BasicDBObject("aunt", "roma") );
System.out.println("count "+coll.aggregate(winner).getCommandResult());
Can anyone help me understand and explain why this is failing?
Thanks K