Skip to content

vmongo is a simple and easy to use nodejs mongodb wrapper

License

Notifications You must be signed in to change notification settings

VironLab/vmongo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vmongo

npm install --save vmongo

License Discord


vmongo is a simple and easy to use nodejs mongodb wrapper


Example Usage

const { VMongoDriver } = require('vmongo');
const connectionString = `mongodb://user:password@localhost:27017/admin`;

const dbHandler = new VMongoDriver(connectionString);
// or
dbHandler = VMongoDriver.simple('user', 'password', 'localhost', 27017, 'admin');

dbHandler.query(
    'database',
    'collection',
    {
        username: 'depascaldc',
    },
    (err, res) => {
        if (err) return console.error(err);
        if (!res[0]) return console.log('No Objects found in Result...');
        console.log(res);
    },
);

dbHandler
    .queryAsync('database', 'collection', {
        username: 'depascaldc',
    })
    .then((res) => {
        if (!res[0]) return console.log('No Objects found in Result...');
        console.log(res);
    })
    .catch((err) => {
        console.error(err);
    });

Discord

Other Links: