[SERVER-9106] Include/Exclude Projection Syntax Created: 24/Mar/13  Updated: 06/Dec/22

Status: Open
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: features we're not sure of

Type: New Feature Priority: Major - P3
Reporter: Sergey Smirnov Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: projection, query
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Optimization
Participants:

 Description   

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.



 Comments   
Comment by Sergey Smirnov [ 03/Oct/13 ]

The formatting of the description was slightly corrupted somewhy.

Comment by Sergey Smirnov [ 24/Mar/13 ]

By the way it is better to add new syntax instead of changing old one.

Generated at Thu Feb 08 03:19:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.