Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-16722

[Server] Docs for $bit expressions have incorrect requirements for numeric bit masks

      The docs for $bitsAllSet, $bitsAllClear, $bitsAnySet and $bitsAnyClear all state that numeric bit mask arguments must be representable as a non-negative 32-bit signed integer, but in the code we accept 64-bit unsigned ints as numeric bit masks. The docs should be updated to match this behavior.

      For example, in the mongo shell, we can run the commands below using 1099511627777 as a bit mask, (where 1099511627777 ~= (2^40) + 1, and cannot fit in a 32 bit int).

       > db.bit.find()
      { "_id" : ObjectId("660cd478ce50ad728988b2e0"), "a" : NumberLong(1) }
      > db.bit.find({a: {$bitsAnySet: NumberLong(1099511627777)}})
      { "_id" : ObjectId("660cd478ce50ad728988b2e0"), "a" : NumberLong(1) } 

            Assignee:
            jason.price@mongodb.com Jason Price
            Reporter:
            kristina.znam@mongodb.com Kristina Znam
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              2 weeks, 3 days ago