This repository contains scripts to seed MongoDB collections and perform aggregations using MongoDB's Node.js Driver.
The create
folder contains scripts to seed MongoDB collections. These scripts utilize the db.createCollection()
command to create collections in the specified database. Each script is structured to create a collection with customizable options, such as capped collections, validation rules, and time series configurations.
To use the seed scripts:
- Open the desired script in a MongoDB environment.
- Modify the
database
andcollection
variables to specify the target database and collection name. - Execute the script to create the collection with the specified options.
For more information on the createCollection
command, refer to the MongoDB Documentation.
The aggregations
folder contains scripts to perform aggregations on MongoDB collections. These scripts utilize the MongoDB Node.js Driver to connect to a MongoDB instance, execute aggregation pipelines, and retrieve results.
To use the aggregation scripts:
- Open the desired script in a Node.js environment.
- Ensure the MongoDB Node.js Driver is installed.
- Modify the aggregation pipeline (
agg
) to define the desired aggregation operations. - Update the MongoDB connection string to point to your MongoDB instance.
- Execute the script to perform the aggregation and retrieve the results.
- MongoDB Node.js Driver: MongoDB Node.js Driver Documentation
For any inquiries or support related to this project, please contact Karl Horning.