-
Type: New Feature
-
Resolution: Unresolved
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Querying
-
Query Optimization
Hello!
I have a proposition for impovements in MongoDB. I want to tell about
db.collection.find() improvements.
Currently syntax of query with projection is like:
db.things.find( { param : "value" } , { field1 : 1, field2: 1 } )
Why don't change the syntax to
db.things.find( { param : "value" } , { (include/exclude): [fields]} )
I'll try to give you examples that you could understand what I mean:
db.things.find( { x : 4 } , {include:[_id, j]} )
db.things.find( { x : 4 } , {exclude:[_id, x]} )
In such syntax we can use _id field as a usual field, an it is not
included to projection implicitly. Another advantage is that we can
just pass array of fields instead of giving 0 or 1 values to field
names.