From MongoDB 4.4, you can use the $isNumber
aggregation pipeline operator to check whether or not a value is a number.
It accepts any valid expression, and returns true
if the expression is a number, false
if it’s not.
Database Management Systems
From MongoDB 4.4, you can use the $isNumber
aggregation pipeline operator to check whether or not a value is a number.
It accepts any valid expression, and returns true
if the expression is a number, false
if it’s not.
The $replaceAll
aggregation pipeline operator was introduced in MongoDB 4.4.
This operator replaces all instances of a search string in an input string with a replacement string and returns the result.
If the search string isn’t found, then $replaceAll
returns the input string.
The $replaceOne
aggregation pipeline operator was introduced in MongoDB 4.4.
This operator replaces the first instance of a search string in an input string with a replacement string and returns the result.
If the search string isn’t found, then $replaceOne
returns the input string.
MongoDB 4.4 introduced the $last
aggregation pipeline operator.
This operator returns the last element in an array.
Continue readingMongoDB 4.4 introduced the $first
aggregation pipeline operator.
This operator returns the first element in an array.
Continue readingIn MongoDB, the $arrayElemAt
aggregation pipeline operator returns the element at the specified array index.
It accepts two arguments;
From MongoDB 4.4, you can use the $bsonSize
aggregation pipeline operator to return the size of a given document in bytes.
$bsonSize
accepts any valid expression as long as it resolves to either an object or null
.
In MongoDB, you can use the Object.bsonSize()
method to return the size of a document in bytes.
From MongoDB 4.4, you can use the $binarySize
aggregation pipeline operator to return the size of a given string or binary data value’s content in bytes.
It accepts any valid expression as long as it resolves to either a string or binary data value. The argument can also be null
, in which case, $binarySize
returns null
.
In MongoDB, you can use the $type
element query operator to filter a collection of documents based on BSON type. It returns just those documents that have a particular BSON type in a specific field.
You provide the field and the BSON type, and $type
will return all documents that match.