Skip to main content

Scalar

A scalar is a single value of either string, boolean (true/false) or numeric

Construction​

You construct a scalar variable by assigning a value to it, e.g.

// Constructing a string scalar
a = "String"

// Constructing a boolean scalar
b = true

// Constructing a numeric (integer) scalar
c = 10

// Constructing a numeric (decimal) scalar
d = 3.14
note

Numeric values always obey the currently configured precision settings which default to 6 decimal places and half_up rounding

Constructor functions​

FunctionDescription
ObjectId()Creates a unique object id
String(text)Creates a new string scalar using the supplied text

Methods​

NameDescriptionReturn Type
isMissing()Checks to see if the value is null or missingBoolean
isZero()Checks to see if the value is zeroBoolean
setPrecisionRoundingMode(mode)Set the rounding mode for numbersScalar
setPrecisionScale(scale)Set the number of decimal places to round toScalar