Skip to content

Commit c12a568

Browse files
jason-price-mongodbjason-price-mongodb
andauthored
DOCSP-10439 bits all clear example (#664) (#676)
* DOCSP-10439-bitsAllClear-example * DOCSP-10439-bitsAllClear-example * DOCSP-10439-bitsAllClear-example Co-authored-by: jason-price-mongodb <[email protected]> Co-authored-by: jason-price-mongodb <[email protected]>
1 parent 9e27b1a commit c12a568

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

source/reference/operator/query/bitsAllClear.txt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,23 @@ The query matches the following documents:
8282
BinData Bitmask
8383
~~~~~~~~~~~~~~~
8484

85-
The following query uses the :query:`$bitsAllClear` operator to test
86-
whether field ``a`` has bits clear at positions ``2`` and ``4``
87-
(the binary representation of ``BinData(0, "ID==")`` is ``00010100``.
85+
The following query uses the :query:`$bitsAllClear` operator:
8886

8987
.. code-block:: javascript
9088

9189
db.collection.find( { a: { $bitsAllClear: BinData(0, "ID==") } } )
9290

93-
The query matches the following documents:
91+
The query:
92+
93+
- Specifies ``0`` as the first value for :bsontype:`BinData
94+
<data_binary>`, which indicates ``ID==`` is to be interpreted as
95+
binary. The base-64 value ``ID==`` in binary is ``00100000``, which
96+
has ``1`` in position 5.
97+
98+
- Uses :query:`$bitsAllClear` to return documents where the ``a`` field
99+
has a clear bit ``0`` in position 5 of the binary value.
100+
101+
The query returns the following documents:
94102

95103
.. code-block:: javascript
96104

0 commit comments

Comments
 (0)