Configuring Sitecore 9.2 to Use MongoDB for xDB
Using MongoDB for xDB in Sitecore 9.2 is an option. By default, the Sitecore Installation Framework (xDB) uses the Shard Map Manger in SQL for this purpose, and is the default recommendation.
However, if your requirements are to run xDB in Sitecore 9.2. using Mongo, here are the steps per the Sitecore 9.2 installation guide (along with some unspoken items):
- Create your MongoDB collection (I named mine “collection”). You will need the connectionString including the username and password in a future step. Its also imperative to ensure the proper ports are open (default is usually 27017 for Mongo)
- Enable the sc.Xdb.Collection.Data.MongoDb.xml.disabled configuration file by removing .disabled extension.
Of note: These are located in the 5 xConnect roles, xConnectCollectionSearch job and 2 Cortex roles within the .\App_Data\Config\Sitecore\Collection directory. You will also need to update this in the xConnectCollectionSearch continuous job (.\sitecore.collectionsearch\App_Data\jobs\continuous\IndexWorker\App_Data\config\sitecore\Collection - Disable the sc.Xdb.Collection.Data.Sql.xml configuration file by adding the .disabled file extension.
Note: Same as item 2, you need to update this in all 8 locations (5 xConnect roles, xConnectCollectionSearch job, and 2 Cortex roles) - Update the collection connectionString to point to the MongoDB instance. You must also update the collection connection string in the indexer job that exists under the xConnect Collection role, xConnectCollectionSearch role, and xConnectCollectionSearch job ( .\sitecore.collectionsearch\App_Data\jobs\continuous\IndexWorker\App_Config). There are a few examples in the installation guide but it should start as mongodb://username:password:port/collection?
- Rebuild the xDB Search Indexes in Solr. This requires using a CMD Prompt as an administrator and browsing to the directory where the xConnectSearchIndexer jobs resides (App_Data\jobs\continuous\IndexWorker) and executing the XConnectSearchIndexer -rr command)
- Check your MongoDB to ensure data is there