Is there a way to say "I only want this key" when you limit your query using a in Mongodb? Or do you have to always actively reject fields using {key_one:0}
For example. I only want to pull the value of key_four with my db.tonight.find().
json structure
{
key_one : "some string",
key_two: "some string",
key_three : "some string",
key_four: "some string",
key_five: "some string",
key_six: "some string"
}
How to simplify this?
Query:
db.tonight.find({},{_id:0,key_six:0,key_five:0,key_three:0,key_two:0,key_one:0})
this way: db.tonight.find({},{_id:0, key_four:1})