Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions source/reference/operator/query/bitsAllClear.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ Integer Bitmask
~~~~~~~~~~~~~~~

The following query uses the :query:`$bitsAllClear` operator to test
whether field ``a`` has bits clear at positions ``0``, ``1``, and ``5``,
because the binary representation of the bitmask ``35`` is ``00100011``.
whether field ``a`` has bits clear at positions ``0``, ``1``, and ``5``
(the binary representation of the bitmask ``35`` is ``00100011``).

.. code-block:: javascript

Expand All @@ -72,8 +72,8 @@ BinData Bitmask
~~~~~~~~~~~~~~~

The following query uses the :query:`$bitsAllClear` operator to test
whether field ``a`` has bits clear at positions `1`, `4`, and `5`, because the
binary representation of ``BinData(0, "MC==")`` is ``00110010``.
whether field ``a`` has bits clear at positions `2` and `4`
(the binary representation of ``BinData(0, "ID==")`` is ``00010100``.

.. code-block:: javascript

Expand Down
9 changes: 4 additions & 5 deletions source/reference/operator/query/bitsAllSet.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ Integer Bitmask
~~~~~~~~~~~~~~~

The following query uses the :query:`$bitsAllSet` operator to test
whether field ``a`` has bits set at positions ``0``, ``1``, and ``5``,
because the binary representation of the bitmask ``35`` is ``00100011``.

whether field ``a`` has bits set at positions ``1``, ``4``, and ``5``
(the binary representation of the bitmask ``50`` is ``00110010``).

.. code-block:: javascript

Expand All @@ -72,8 +71,8 @@ BinData Bitmask
~~~~~~~~~~~~~~~

The following query uses the :query:`$bitsAllSet` operator to test
whether field ``a`` has bits set at positions `1`, `4`, and `5`, because the
binary representation of ``BinData(0, "MC==")`` is ``00110010``.
whether field ``a`` has bits set at positions `4` and `5`
(the binary representation of ``BinData(0, "MC==")`` is ``00110000``).

.. code-block:: javascript

Expand Down
12 changes: 6 additions & 6 deletions source/reference/operator/query/bitsAnyClear.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,28 @@ Integer Bitmask
~~~~~~~~~~~~~~~

The following query uses the :query:`$bitsAnyClear` operator to test
whether field ``a`` has any bits clear at positions ``0``, ``1``, and ``5``,
because the binary representation of the bitmask ``35`` is ``00100011``.
whether field ``a`` has any bits clear at positions ``0``, ``1``, and ``5``
(the binary representation of the bitmask ``35`` is ``00100011``).

.. code-block:: javascript

db.collection.find( { a: { $bitsAnyClear: 50 } } )
db.collection.find( { a: { $bitsAnyClear: 35 } } )

The query matches the following documents:

.. code-block:: javascript

{ "_id" : 1, "a" : 54, "binaryValueofA" : "00110110" }
{ "_id" : 2, "a" : 20, "binaryValueofA" : "00010100" }
{ "_id" : 3, "a" : 20.0, "binaryValueofA" : "00010100" }
{ "_id" : 4, "a" : BinData(0,"Zg=="), "binaryValueofA" : "01100110" }


BinData Bitmask
~~~~~~~~~~~~~~~

The following query uses the :query:`$bitsAnyClear` operator to test
whether field ``a`` has any bits clear at positions `1`, `4`, and `5`, because
the binary representation of ``BinData(0, "MC==")`` is ``00110010``.
whether field ``a`` has any bits clear at positions `4` and `5`
(the binary representation of ``BinData(0, "MC==")`` is ``00110000``).

.. code-block:: javascript

Expand Down
12 changes: 5 additions & 7 deletions source/reference/operator/query/bitsAnySet.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,28 +54,26 @@ Integer Bitmask
~~~~~~~~~~~~~~~

The following query uses the :query:`$bitsAnySet` operator to test
whether field ``a`` has any bits set at positions ``0``, ``1``, and ``5``,
because the binary representation of the bitmask ``35`` is ``00100011``.
whether field ``a`` has any bits set at positions ``0``, ``1``, and ``5``
(the binary representation of the bitmask ``35`` is ``00100011``).

.. code-block:: javascript

db.collection.find( { a: { $bitsAnySet: 50 } } )
db.collection.find( { a: { $bitsAnySet: 35 } } )

The query matches the following documents:

.. code-block:: javascript

{ "_id" : 1, "a" : 54, "binaryValueofA" : "00110110" }
{ "_id" : 2, "a" : 20, "binaryValueofA" : "00010100" }
{ "_id" : 3, "a" : 20.0, "binaryValueofA" : "00010100" }
{ "_id" : 4, "a" : BinData(0,"Zg=="), "binaryValueofA" : "01100110" }

BinData Bitmask
~~~~~~~~~~~~~~~

The following query uses the :query:`$bitsAnySet` operator to test
whether field ``a`` has any bits set at positions `1`, `4`, and `5`, because the
binary representation of ``BinData(0, "MC==")`` is ``00110010``.
whether field ``a`` has any bits set at positions `4`, and `5`
(the binary representation of ``BinData(0, "MC==")`` is ``00110000``).

.. code-block:: javascript

Expand Down