Connect Over the Wire Protocol¶
On this page
MongoDB Realm natively implements a subset of the MongoDB wire protocol, which allows you to connect to a Realm app through one of its linked MongoDB clusters using standard MongoDB drivers and tools. Clients use a specialized MongoDB Realm connection string to connect and send requests. MongoDB Realm 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 MongoDB Realm.
You must enable wire protocol connections for one or more linked clusters in your application before you can connect over the wire protocol.
Data Lake data sources do not support connections via the wire protocol.
You can use the following tools and drivers to communicate with MongoDB Realm 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.
Connect to Realm with a Connection String¶
Perform CRUD Operations¶
While connected to MongoDB Realm over the wire protocol you can use standard MongoDB CRUD operations. MongoDB Realm 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.
Call a Service Function¶
You can call service actions using the
Get the Logged In User's Data¶
You can get the user object for the
authenticated user using the