mongo-simple-driver

1.0.1 • Public • Published

MongoSimpleDriver

Mongo db simple driver for nodejs

Use

Initial

	let mongoSimpleDriver = require('mongo-simple-driver');

	MongoConfig = {
		url: 'mongodb://localhost:27017',
		dbName: 'testDatabase',
		collectionName: 'testCollection'
	};

	let MongoSimpleDriver = new MongoSimpleDriverClass(MongoConfig);

Method find

1 argument - object

2 argument - callback function

3 argument - string, not required. Another collection name.

	MongoSimpleDriver.get({a: 3}, function (documents) {
		console.log(documents);
	})

Method insertMany

1 argument - array of objects

2 argument - callback function

3 argument - string, not required. Another collection name.

	MongoSimpleDriver.create([{a: 3}], function (result) {
		console.log(result);
	})

Method updateOne

1 argument - data

2 argument - new data

3 argument - callback function

4 argument - string, not required. Another collection name.

	MongoSimpleDriver.update({a: 3}, {a: 6}, function (result) {
		console.log(result);
	})

Method deleteOne

1 argument - object with data

2 argument - callback function

3 argument - string, not required. Another collection name.

	MongoSimpleDriver.remove({a: 3}, function (result) {
		console.log(result);
	})

Readme

Keywords

Package Sidebar

Install

npm i mongo-simple-driver

Weekly Downloads

2

Version

1.0.1

License

ISC

Unpacked Size

8.34 kB

Total Files

6

Last publish

Collaborators

  • alexandr_maiboroda