Values are named constants that you can use in MongoDB Stitch rules and pipelines. To access a value in rules or pipelines, use the %%values expansion.

Define Values

In the MongoDB Stitch console,


Go to Values.

Under the Control section in the left-hand navigation bar, click Values.


Enter a name for the new value in the New Value Name box.


Enter a value in the box below New Value Name.

The value must be a string, an array, or a valid JSON document. The following are all examples of valid values:

Name Value
publicStatus "Public"
adminUsers ["589a86bcfc57bd5c25c51de8", "629a82befc57bd5c20a51ed7"]
   "email": "",
   "phone": "+1-111-111-1111"

(Optional) Enable Private mode to prevent MongoDB Stitch client applications from accessing the value.

Private values may be accessed only by incoming webhooks, rules, and named pipelines.

Usage Examples

To access a value in rule or pipeline expressions, use the %%values expansion. The examples use the values defined in the Define Values section.

Values in MongoDB Rules

For example, you might specify a MongoDB service write rule where a field is writable if the authenticated user is one of the users defined in the value adminUsers:

{ "%%user.idHex": { "%in": "%%values.adminUsers" } }

Values in Pipelines

For example, you might include a value contactDetail in the Arguments of a pipeline stage:

  "subject": "Happy Birthday",
  "fromAddress": ""
←   Expansions Authentication  →