MongoDB.local SF, Jan 15: See the speaker lineup & ship your AI vision faster. Use WEB50 to save 50%
Find out more >
Docs Menu
Docs Home
/ /

Bitwise Update Operator

Note

For details on a specific command, including syntax and examples, click on the link to the command's reference page.

Name
Description

$bit

Performs bitwise AND, OR, and XOR (exclusive OR) updates of integer values. The $bit operator performs a bitwise update of a field.

The $bit operator can only be used with integer and long values. The integers must be 32-bit integer or 64-bit integer values.

All numbers in mongosh are double precision floating point numbers, not integers. To define integers in mongosh, use the Int32() or Long() constructors. For example, Int32(5), Long(23455).

To learn more about integers and long numbers, see Int32 and Long.

Back

$sort