[SERVER-30365] How to exclude (sub)fields starting with $ in a query projection Created: 27/Jul/17 Updated: 06/Dec/22 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Mattia Borini | Assignee: | Backlog - Query Optimization |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | query-44-grooming | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Assigned Teams: |
Query Optimization
|
||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Description |
|
I'm querying the oplog.rs collection and I would like to exclude the o.$set field from the results. The 'o.$set': 0 projection gives an error: There doesn't seem to be other ways to exclude it. Am I wrong? Is it possible? |
| Comments |
| Comment by Charlie Swanson [ 27/Jul/17 ] | ||||||||||||
|
I don't think there is a way to do it. In versions 3.4.4 and above you can use the aggregation framework and the $objectToArray and $arrayToObject expressions to work around this issue:
|