MongoDB $stdDevSamp

In MongoDB, the $stdDevSamp aggregation pipeline operator calculates the sample standard deviation of the input values.

The input values can be from a group of documents (i.e. documents that are grouped by the same key), or they can be multiple fields within a single document.

Read more

MongoDB $strcasecmp

In MongoDB, the $strcasecmp aggregation pipeline operator performs a case-insensitive comparison of two strings.

It returns either 1, 0, or -1, depending on whether or not the first string is greater than, equal to, or less than the second string.

Read more

MongoDB $split

In MongoDB, the $split aggregation pipeline operator divides a string into an array of substrings based on a delimiter.

The delimiter is removed from the string, and the substrings are added as elements to the array.

To use $split, you specify the string and the delimiter.

If the delimiter isn’t found in the string, the original string is returned as the only item in the array.

Read more

MongoDB $slice

In MongoDB, the $slice aggregation pipeline operator returns a subset of an array.

To use $slice, you specify the number of elements to return from the array. You can also specify a starting position for which to take the subset from the array.

Read more

MongoDB $size

In MongoDB, the $size aggregation pipeline operator counts and returns the total number of items in an array.

The $size operator accepts one argument. The argument can be any valid expression that resolves to an array.

Read more

MongoDB $setUnion

In MongoDB, the $setUnion aggregation pipeline operator accepts two or more arrays and returns an array containing the elements that appear in any of those input arrays.

$setUnion accepts two or more arguments, all of which can be any valid expression as long as they each resolve to an array. $setUnion treats the arrays as sets.

Read more

MongoDB $setIsSubset

In MongoDB, the $setIsSubset aggregation pipeline operator accepts two arrays and returns true when the first array is a subset of the second, and false when it isn’t.

The first array is also considered a subset when it equals the second array.

Read more

MongoDB $setIntersection

In MongoDB, the $setIntersection aggregation pipeline operator accepts two or more arrays and returns an array that contains the elements that appear in all input arrays.

$setIntersection accepts two or more arguments, all of which can be any valid expression as long as they each resolve to an array. $setIntersection treats the arrays as sets.

Read more

MongoDB $setEquals

In MongoDB, the $setEquals aggregation pipeline operator compares two or more arrays and returns true if they have the same distinct elements and false otherwise.

$setEquals accepts two or more arguments, all of which can be any valid expression as long as they each resolve to an array. $setEquals treats the arrays as sets.

Read more

MongoDB $setDifference

In MongoDB, the $setDifference aggregation pipeline operator accepts two sets and performs a relative complement of the second set relative to the first. It returns an array containing the elements that only exist in the first set.

$setDifference accepts two arguments, both of which can be any valid expression as long as they each resolve to an array. $setDifference treats the arrays as sets.

Read more