Docs Home → Atlas App Services
On this page
- Compatible Clients
- Connection Strings
- Enable Wire Protocol Connections
- Navigate to the Data Source Configuration Screen
- Enable Connection Strings for the Cluster
- Select the Authentication Method
- Pull the Latest Version of Your App
- Enable Wire Protocol for the Cluster
- Deploy the Updated Data Source Configuration
- Connect Over the Wire Protocol
- Connect to App Services with a Connection String
- Read and Modify Data
- Call a Function
- Call a Service Action [DEPRECATED]
- Get the Logged In User's Data
Atlas App Services natively implements a subset of the MongoDB wire protocol, which allows you to connect to an App through one of its linked MongoDB Atlas data sources using standard MongoDB drivers and tools. Clients use a specialized App Services connection string to connect and send requests. App Services supports most client features over the wire protocol, including role-based data access rules, functions, and service actions.
This is a good choice for languages that do not currently have a Realm
SDK. The examples here are for Python, C++11, and the Mongo Shell. Any
MongoDB driver that supports the
appName connection string parameter can use the wire protocol to
connect to App Services.
Federated data sources do not support connections via the wire protocol.
You can use the following tools and drivers to communicate with App Services using a connection string:
Version 4.0+ of the mongo shell.
Any MongoDB driver that supports the
appNameconnection string parameter. All official MongoDB drivers support this parameter in their current releases.
Connections to App Services over the wire protocol have access to the full functionality of the MongoDB Service. However, App Services does not support all operations and features available in standard tools and clients. For details, see MongoDB Service Limitations.
To connect to App Services over the wire protocol, you must construct a
MongoDB connection string that
includes credentials for an application user and an
appName query parameter.
You must URL encode connection strings before you can use them to connect to App Services. Connection strings in the App Services UI are properly encoded by default.
App Services connection strings have the following form:
All operations that you issue over the wire protocol run in the context of a specific application user that you specify in the connection string. The user must be registered with one of the following authentication providers:
The contents of connection string credentials depend on the authentication provider with which the user registered:
The connection string must specify the deployment region and cloud provider in which the App is hosted.
Global Apps use the
Local Apps specify the cloud provider and region name using
<region>.<cloud> format. For example, an app deployed to
aws-us-east-1 would use the following connection string:
App Services requires specific connection string options that identify the application you want to connect to and the authentication provider associated with the credentials that you provide.
App Services connection strings have the following query parameters:
This parameter should always be set to
This parameter should always be set to
Uniquely identifies the application, MongoDB service, and authentication provider to which you want to connect.
Enable Wire Protocol Connections
You must enable wire protocol connections for a linked clusters before you can connect to an App Services App with a connection string.
Connect Over the Wire Protocol
Connect to App Services with a Connection String
To connect to App Services over the wire protocol, pass a URL-encoded App Services connection string when you create a client, just as you would with a regular connection string.
Read and Modify Data
While connected to App Services over the wire protocol you can use standard MongoDB CRUD operations. App Services applies role-based data access rules to all queries in the context of the authenticated user specified in the connection string credentials.
Call a Function
You can call functions using the
callFunction database command.
Calls the specified function and returns any result.
Call a Service Action [DEPRECATED]
You can call service actions using the
Calls the specified service action and returns any result.
Get the Logged In User's Data
You can get the user object for the authenticated
user using the
userProfile database command.
Returns the user object for the authenticated user.