Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-32861

Aggregation coercion to bool should not consider the empty string as true

    • 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.

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            charlie.swanson@mongodb.com Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: