Estimated completion time: 5 minutes
To use MongoDB Search and Vector Search in Community, you must connect to your MongoDB Community deployment. Use the following methods to connect to your MongoDB Community deployment:
The MongoDB Shell, an interactive command line interface to MongoDB.
MongoDB Compass, a GUI for your MongoDB data.
A MongoDB driver. To see all available languages, refer to the MongoDB Driver documentation.
Use the drop-down menus to select the interface and languages, when applicable, for the procedure on this page.
Prerequisites
Before you start, you must have the following prerequisites:
MongoDB Community and MongoDB Search Community
Note
Make sure that both the
mongodandmongotprocesses are running.Valid username and password to connect
If you haven't already created a user on your replica set, run the following commands in your terminal to create a user:
Connect to replica set by using
mongosh.mongosh Run the following commands to create a
mongotUseruser in theadmindatabase with thesearchCoordinatorrole. MongoDB uses themongotUseruser to authenticatemongotwithmongod.use admin db.createUser( { user: "mongotUser", pwd: passwordPrompt(), roles: [ { role: "searchCoordinator", db: "admin" } ] } ) Users with the
searchCoordinatorrole havereadAnyDatabaseprivileges and write permissions on the__mdb_internal_searchdatabase.Important
Do not modify the contents of the
__mdb_internal_searchdatabase.
- Connection string to the replica set
The connection string for a replica set includes all member nodes. Therefore, you need the replica set name and the hostnames or IP addresses and ports of all the replica set members to connect.
Connect to Your Replica Set
Use your replica set's connection string to connect to your replica set with your preferred client. To ensure that you configured mongot and mongod correctly, you can run a command that retrieves search indexes.
Next Steps
Now that you've connected to your replica set, proceed to Query with MongoDB Search and Vector Search in Community.