Hello, This is my current query: Using Java+mongoDB
{
BasicDBObject select = new BasicDBObject();
select.put("info.name.fn", 1);
DBCursor cursor = collection.find(new BasicDBObject(), select);
while (cursor.hasNext()) {
System.out.println(cursor.next());
}
It gives an output as:
{ "_id" : { "$oid" : "123"} , "info" : { "name" : { "fn" : "foo"}}}
{ "_id" : { "$oid" : "123"} , "info" : { "name" : { "fn" : "bar"}}}
{ "_id" : { "$oid" : "123"} , "info" : { "name" : { "fn" : "baz"}}}
_ids changed to accommodate the output. My question is, what query do I give to get the output as:
foo
bar
baz
Is it even possible? Or does every query always return it in the above format? I cant run a distinct() because there are duplicate names.
Thanks.