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

$exists requires true, should also accept 1

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.9.0
    • Affects Version/s: 1.6.5
    • Component/s: Querying
    • Labels:
      None
    • ALL

      I would have expected the following two queries to be identical. Apparently, $exists requires an explicit "true". By analogy with the usual query syntax, I would have expected $exits: 1 to be the same as $exists: true, but it appears not to be. I'm not sure if this is a bug, but it certainly does violate the principle of least astonishment.

      > db.users.find({is_dup_of: {$exists: true}}).count()
      225
      > db.users.find({is_dup_of: {$exists: 1}}).count()
      304849

            Assignee:
            aaron Aaron Staple
            Reporter:
            roysmith Roy Smith
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: