Skip to content

An utility MongoDB library written in NodeJS. An end to end plausible solution to deal with MongoDB.

License

Notifications You must be signed in to change notification settings

ShoppinPal/mongodb-nodejs-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MongoDB NodeJS SDK -

To use this SDK you need to configure the DB_URL by setting it as an environment variable.

For example - export DB_URL="<MONGODB_VALID_URL_STRING>"

Docs - https://shoppinpal.github.io/mongodb-nodejs-sdk/

NPM - https://www.npmjs.com/package/mongodb-nodejs-sdk

This SDK takes care of everything starting from connecting to mongo and taking care of graceful shutdowns. All you need to be aware of are the methods of this SDK and all the methods returns a promise.

Sample Usage -

var mongoUtils = require('mongodb-nodejs-sdk');

var doSomethingWithTheSetOfDocuments = function doSomethingWithTheSetOfDocuments(){
    return mongoUtils.findDocumentsBasedOnQuery('mongoCollectionName', {status: "done"}, 0, {_id: 0})
        .then(function(documents){
            console.log(`Documents found in collection mongoCollectionName`, documents.length); 
            return Promise.resolve(documents); //Do anything with the set of returned documents.
        })
        .catch(function(error){
            return Promise.reject(error);
        });
};

About

An utility MongoDB library written in NodeJS. An end to end plausible solution to deal with MongoDB.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published