Mongodb Query To select records having a given key
- by sagar
let the records in database are
{"_id":"1","fn":"sagar","ln":"Varpe"}
{"_id":"1","fn":"sag","score":"10"}
{"_id":"1","ln":"ln1","score":"10"}
{"_id":"1","ln":"ln2"}
I need to design a MongoDB query to find all records who has a given key
like if i pass "ln" as a parameter to query it shold return all records in which "ln"is a Key , the results fo are
{"_id":"1","fn":"sagar","ln":"Varpe"}
{"_id":"1","ln":"ln1","score":"10"}
{"_id":"1","ln":"ln2"}