[SERVER-4486] $true or $truthValue query operator Created: 13/Dec/11  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Mathias Stearn Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Optimization
Participants:

 Description   

db.foo.remove({temporary: {$truthValue: true}})

Probably should share semantics (but not name) with BSONElement::trueValue() where 0, false, null, undefined, and missing are false and everything else is true. Alternatively we may want to treat empty Strings, Objects, and Arrays as false like python.

This can be approximated with an $in/$nin query, but I think it would be nice to have a proper query operator.



 Comments   
Comment by David Percy [ 15/Dec/20 ]

I think $expr is a pretty natural way to write this:

db.foo.remove({ $expr: "$temporary" })

Although it looks like we don't generate index bounds for it.

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