Skip to content

Operator Reference

This is a full list of all the out-of-the-box operators. If you want to create your own operator, check out the Custom Operators page.

General

  • $array: Creates an array of values.
  • $avg: Calculates the average of the input array elements.
  • $bin: Creates random binary data of a specified size.
  • $boolean: Creates a random boolean value.
  • $concat: Merges multiple arrays into a single array.
  • $choose: Chooses one element from an array of possible choices.
  • $distinct: Returns the distinct set of the input array.
  • $hash: Returns the hash of the input.
  • $inc: Increments the input value.
  • $join: Joins elements of an array to a string.
  • $max: Returns the max value from an array of elements.
  • $min: Returns the min value from an array of elements.
  • $mod: Returns the modulus of the input.
  • $objectId: Returns a new ObjectId.
  • $optional: A wrapper to optionally include/exclude the value.
  • $pick: Returns an element from an array.
  • $pickset: Returns a subset of an array.
  • $regex: Returns a Regular Expression object.
  • $uuid: Generates a random UUID.

Sequence

Numeric

  • $decimal: Returns a random Decimal 128.
  • $floating: Returns a random floating point.
  • $int: Returns a random 32-bit integer.
  • $long: Returns a random 64-bit integer.

Time / Date

  • $dt: Returns a random date, optionally in a given range.
  • $now: Returns the current date.
  • $dayOfMonth: Day of month of input date.
  • $dayOfWeek: Day of week of input date.
  • $dayOfYear: Day of year of input date.
  • $epoch: Epoch of input date.
  • $hour: Hour of input date.
  • $minute: Minute of input date.
  • $month: Month of input date.
  • $second: Second of input date.
  • $ts: Creates a random BSON timestamp.
  • $year: Year of input date.

Text

  • $character: Returns a random character from a pool of characters.
  • $paragraph: Returns a random paragraph.
  • $sentence: Returns a random sentence.
  • $string: Returns a string of a defined length.
  • $word: Returns a random word.

Geospatial

Internet

  • $domain: Returns a random www domain name.
  • $email: Returns a random email address.
  • $ip: Generates a random IPv4 address.
  • $ipv6: Generates a random IPv6 address.
  • $macAdress: Generates a random MAC address.
  • $url: Generates a random URL.
  • $username: Generates a random username.

Location

  • $city: Generates a random city.
  • $country: Generates a random country.
  • $phone: Generates a random phone number.
  • $postal: Generates a random post code.
  • $state: Generates a random state.
  • $street: Generates a random street.
  • $zip: Generates a random zip code.

Person

  • $age: Generates a random age.
  • $birthday: Generates a random birthday.
  • $first: Generates a random first name.
  • $gender: Generates a random gender.
  • $last: Generates a random last name.
  • $maritalStatus: Generates a random marital status.
  • $name: Generates a name.
  • $prefix: Generates a random salutation.
  • $ssn: Generates a random social security number.
  • $suffix: Generates a random title (e.g. esq.).