Mongo Redux
Mongo Redux is a thin wrapper around MongoDB basic functionality. Aims to provide simple functions on the async/await pattern for short and readable commands.
Get Started
- Add to your project with:
npm i mongo-redux
. - In your code:
// Import the moduleconst Mongo = ; // Instance a new clientlet mongo = ; // Start a connectionawait mongo; // Use functionallity // insert ( collection, data ) => Booleanawait mongo; // exists ( collection, key, value ) => Booleanawait mongo; // get ( collection, key, value ) => Object | falseawait mongo; // find ( collection, query, projection ) => Array | falseawait mongo; // delete ( collection, key, value ) => Booleanawait mongo; // update ( collection, key, value, updateSpec ) => Booleanawait mongo; // replace ( collection, key, value, replacements ) => Booleanawait mongo; // push ( collection, key, value, arrayAndNewValue ) => Booleanawait mongo; // pull ( collection, key, value, arrayAndTargetValue ) => Booleanawait mongo; // Create indexesawait mongoindex'Test' email: 1 unique: true ; // Access mongodb Database objectlet info = await mongodb; // Close the connectionawait mongo;
Reporting Bugs
If you have found any problems with this module, please:
- Open an issue.
- Describe what happened and how.
- Also in the issue text, reference the label
~bug
.
We will make sure to take a look when time allows us.
Proposing Features
If you wish to have that awesome feature or have any advice for us, please:
- Open an issue.
- Describe your ideas.
- Also in the issue text, reference the label
~proposal
.
Contributing
If you have spotted any enhancements to be made and is willing to get your hands dirty about it, fork us and submit your merge request so we can collaborate effectively.