Folder-DB-Sync is a Node.js script that watches and synchronizes JSON files in multiple folders with a MongoDB database. When a file is added, modified, or deleted, the script updates the corresponding MongoDB collection accordingly.
- Watches multiple folders with JSON files
- Synchronizes JSON files with MongoDB collections
- Inserts the MongoDB
_id
field back into the JSON files - Supports adding, modifying, and deleting files
- Node.js
- MongoDB
-
Clone the repository:
https://github.com/stevelab1/folder-db-sync
-
Navigate to the project folder:
cd folder-db-sync
-
Install dependencies:
npm i
-
Create a
.env.local
file in the project root and set yourMONGODB_URI
environment variable
-
Run the script:
npm run watch-folder
-
The script will watch the specified folders in the
data
directory and sync them with the MongoDB collections. -
Add or modify JSON files in the watched folders to see the changes reflected in the MongoDB collections.
Pending