Aggregate Functions
-
COUNT(array)
- Returns the number of elements inarray
-
MIN(array)
- Returns the lowest value inarray
-
MAX(array)
- Returns the highest value inarray
-
FIRST(array)
- Returns the first element inarray
-
LAST(array)
- Returns the last element inarray
-
AVG(array)
- Returns the average value of the numerical values inarray
(ignores non-numerical values) -
SUM(array)
- Returns the sum of the numerical values inarray
(ignores non-numerical values) -
ANY(array)
- Returnstrue
ifarray
has any elements
DataType Functions
-
MINVALUE()
- Returns the singleton instance ofMinValue
-
MAXVALUE()
- Returns the singleton instance ofMaxValue
-
OBJECTID()
- Returns a new instance ofObjectId
-
GUID()
- Returns a new instance ofGuid
-
NOW()
- Returns the current timestamp in local time -
NOW_UTC()
- Returns the current timestamp in UTC -
TODAY()
- Returns the current date at 00h00min00s -
INT32(value)
- Returnsvalue
converted toInt32
, ornull
if not possible -
INT64(value)
- Returnsvalue
converted toInt64
, ornull
if not possible -
DOUBLE(value, culture)
- Returnsvalue
converted toDouble
according to the specified culture, ornull
if not possible -
DECIMAL(value, culture)
- Returnsvalue
converted toDecimal
according to the specified culture, ornull
if not possible -
STRING(value)
- Returns the string representation ofvalue
-
BINARY(value)
- Returnsvalue
converted toBsonBinary
, ornull
if not possible -
OBJECTID(value)
- Returnsvalue
converted toObjectId
, ornull
if not possible -
GUID(value)
- Returnsvalue
converted toGuid
, ornull
if not possible -
BOOLEAN(value)
- Returnsvalue
converted toBoolean
, ornull
if not possible -
DATETIME(value, culture)
- Returnsvalue
converted toDateTime
in local time according to the specified culture, ornull
if not possible -
DATETIME_UTC(value, culture)
- Returnsvalue
converted toDateTime
in UTC according to the specified culture, ornull
if not possible -
DATETIME(year, month, day)
- Returns a newDateTime
at 00h00min00s in local time based on the providedyear
,month
andday
-
DATETIME_UTC(year, month, day)
- Returns a newDateTime
at 00h00min00s in UTC based on the providedyear
,month
andday
-
IS_MINVALUE(value)
- Returnstrue
ifvalue
isMinValue
,false
otherwise -
IS_MAXVALUE(value)
- Returnstrue
ifvalue
isMaxValue
,false
otherwise -
IS_NULL(value)
- Returnstrue
ifvalue
isnull
,false
otherwise -
IS_INT32(value)
- Returnstrue
ifvalue
isInt32
,false
otherwise -
IS_INT64(value)
- Returnstrue
ifvalue
isInt64
,false
otherwise -
IS_DOUBLE(value)
- Returnstrue
ifvalue
isDouble
,false
otherwise -
IS_DECIMAL(value)
- Returnstrue
ifvalue
isDecimal
,false
otherwise -
IS_NUMBER(value)
- Returnstrue
ifvalue
is of a numerical type,false
otherwise -
IS_STRING(value)
- Returnstrue
ifvalue
isString
,false
otherwise -
IS_DOCUMENT(value)
- Returnstrue
ifvalue
isBsonDocument
,false
otherwise -
IS_arrayAY(value)
- Returnstrue
ifvalue
isBsonarrayay
,false
otherwise -
IS_BINARY(value)
- Returnstrue
ifvalue
isBsonBinary
,false
otherwise -
IS_OBJECTID(value)
- Returnstrue
ifvalue
isObjectId
,false
otherwise -
IS_GUID(value)
- Returnstrue
ifvalue
isGuid
,false
otherwise -
IS_BOOLEAN(value)
- Returnstrue
ifvalue
isBoolean
,false
otherwise -
IS_DATETIME(value)
- Returnstrue
ifvalue
isDateTime
,false
otherwise
Date Functions
-
YEAR(value)
- Returns the year ofvalue
, ornull
if it is not aDateTime
-
MONTH(value)
- Returns the month ofvalue
, ornull
if it is not aDateTime
-
DAY(value)
- Returns the day ofvalue
, ornull
if it is not aDateTime
-
HOUR(value)
- Returns the hour ofvalue
, ornull
if it is not aDateTime
-
MINUTE(value)
- Returns the minutes ofvalue
, ornull
if it is not aDateTime
-
SECOND(value)
- Returns the seconds ofvalue
, ornull
if it is not aDateTime
-
DATEADD(dateInterval, amount, value)
dateInterval
is one of the following:y|year
,M|month
,d|day
,h|hour
,m|minute
,s|second
amount
is the amount of units defined bydateInterval
to be added tovalue
-
DATEDIFF(dateInterval, start, end)
dateInterval
is one of the following:y|year
,M|month
,d|day
,h|hour
,m|minute
,s|second
start
andend
are dates- The function returns the difference between the dates in units defines by
dateInterval
-
TO_LOCAL(date) - Returns
date
converted to local time, ornull
if is not aDateTime
-
TO_UTC(date) - Returns
date
converted to UTC, ornull
if is not aDateTime
Math Functions
-
ABS(value)
- Returns the absolute value ofvalue
, ornull
if it is not a numerical value -
ROUND(value, digits)
- Returnsvalue
rounded todigits
of precision, ornull
if it is not a numerical value -
POW(x, y)
- Returnsx
to the power ofy
(always as aDouble
), ornull
if either of them is not a numerical value
String Functions
-
LOWER(value)
- Returnsvalue
in lower case, ornull
if it is not aString
-
UPPER(value)
- Returnsvalue
in upper case, ornull
if it is not aString
-
LTRIM(value)
- Returns a new string with leading whitespaces removed, ornull
if it is not aString
-
RTRIM(value)
- Returns a new string with trailing whitespaces removed, ornull
if it is not aString
-
TRIM(value)
- Returns a new string with leading and trailing whitespaces removed, ornull
if it is not aString
-
INDEXOF(value, match)
- Returns the zero-based index of the first occurrence ofmatch
invalue
-
INDEXOF(value, match, startIndex)
- Returns the zero-based index of the first occurrence ofmatch
invalue
. The search starts instartIndex
-
SUBSTRING(value, startIndex)
- Returns the substring ofvalue
fromstartIndex
to the end -
SUBSTRING(value, startIndex, length)
- Returns the substring ofvalue
starting fromstartIndex
and with length specified bylength
-
SUBSTRING(value, oldValue, newValue)
- Returns a new string with occurrences ofoldValue
replaced bynewValue
-
LPAD(value, totalWidth, paddingChar)
- Returns a new string left-padded tototalWidth
length withpaddingChar
-
RPAD(value, totalWidth, paddingChar)
- Returns a new string right-padded tototalWidth
length withpaddingChar
-
SPLIT(value, separator)
- Returns an arrayay containing the substrings ofvalue
split byseparator
-
FORMAT(value, format)
- Returns the string representation ofvalue
with the provided format -
JOIN(array)
- Takes an array of string and returns those strings joined by,
-
JOIN(array, separator)
- Takes an array of string and returns those strings joined byseparator
Misc Functions
-
JSON(value)
- Takes a string representation of a JSON and returns a parsedBsonValue
-
EXTEND(source, extend)
- Merges two documents into one, copying their attributes. -
CONCAT(array1, array2)
- Returns a new array containt the concatenation ofarray1
andarray2
-
KEYS(document)
- Returns an array containing every key indocument
-
OID_CREATIONTIME(objectId)
- Returns the creation time ofobjectId
-
IIF(predicate, ifTrue, ifFalse)
- ReturnsifTrue
ifpredicate
evaluates totrue
,false
otherwise -
COALESCE(left, right)
- Returnsleft
if it is notnull
,right
otherwise -
LENGTH(value)
- Returns the lenght ofvalue
(if value isString
,Binary
,Array
orDocument
) -
TOP(values, num)
- Returns the firstnum
elements fromvalues
-
UNION(array1, array2)
- Returns the set union betweenarray1
andarray2
-
EXCEPT(array1, array2)
- Returns the set difference betweenarray1
andarray2
-
DISTINCT(array)
- Returns the distinct elements fromarray
-
RANDOM()
- Returns a randomInt32
-
RANDOM(min, max)
- Returns a randomInt32
betweenmin
andmax