The records in my 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 that have a given key.
For example, if I pass ln
as a parameter to the query it shuold return all records in which ln
is a key. The results would be
{"_id":"1","fn":"sagar","ln":"Varpe"}
{"_id":"1","ln":"ln1","score":"10"}
{"_id":"1","ln":"ln2"}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…