Changing Persistent Storage Connector
This guide will take you through the steps required to change the storage connector from Filesystem to MongoDB and vice versa.
From Filesystem to MongoDB
The boilerplate uses Filesystem as the default database system. If you want to set up Contentstack DataSync with MongoDB, perform the following steps:
- Delete the .token and _contents folders before switching to MongoDB.
- Setup the MongoDB server and have it running.
- Go to the config folder, open the index.js file, and add the following line of code to switch to MongoDB:
export const config = { contentStoreModule: '@contentstack/datasync-content-store-mongodb' }
- Restart the application. Now, Contentstack DataSync will use the MongoDB database instead of using Filesystem, and then will create “contentstack-persistent-db” in mongodb and _contents collection. The assets will be stored inside _contents folder.
From MongoDB to Filesystem
If you started the application with MongoDB as database and want to switch Filesystem instead, perform the following steps:
- Delete the .token folder.
- Go to the config folder, open the config.js file, and add the following line of code to switch to Filesystem:
export const config = { contentStoreModule: '@contentstack/datasync-content-store-filesystem' }
- Restart the application. Contentstack DataSync will now use Filesystem as the database instead of MongoDB.