-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Aggregation Framework
-
Query Optimization
When used in a boolean concept, all strings are considered to be truthy. For example:
> db.foo.aggregate([{$project: {x: {$cond: {if: "", then: "hi", else: "bye"}}}}]) { "_id" : ObjectId("5a31839ba9fb0c07a00ff123"), "x" : "hi" }
Most programming languages treat the empty string as "falsey". I think it would be less confusing for our users if we do the same.