A microservice that can be used by other applications to perform all CRUD operations for MongoDB.
The crud-sdk helps developers to perform create, read, update, delete operations on MongoDB for any application.
The project is hosted on GitHub.
Make sure you have Node.js 8.9.0 or higher installed. If not, install it.
var crud = require('crud-sdk');
crud.create( <collection-name>, {DATA in JSON Format}, function (err, data) {
if (err) // do something
});
crud.update( <collection-name>, {Field/Data to be updated in JSON}, {Update Condition in JSON}, function (err, result) {
if (err) // do something
});
crud.updateById( <collection-name>, {Field/Data to be updated in JSON}, <mongo-objectId>, function (err, result) {
if (err) // do something
});
crud.updateMultiple( <collection-name>, {Field/Data to be updated in JSON}, {Update Condition in JSON}, function (err, result) {
if (err) // do something
});
crud.delete( <collection-name>, {Delete Condition in JSON}, function (err, result) {
if (err) // do something
});
crud.deleteById( <collection-name>, <mongo-objectId>, function (err, result) {
if (err) // do something
});
crud.readById( <collection-name>, <mongo-objectId>, {Params Condition in JSON Format}, function (err, result) {
if (err) // do something
});
crud.readByCondition( <collection-name>, {Read Condition in JSON Format},{Params Condition in JSON Format}, function (err, result) {
if (err) // do something
});
crud.readByMultipleConditions( <collection-name>, {Read Condition1 in JSON Format}, {Read Condition2 in JSON Format},{Params Condition in JSON Format}, function (err, result) {
if (err) // do something
});
crud.readByCondition( <collection-name>, {}, function (err, result) {
if (err) // do something
});
crud.sort( <collection-name>, {Read Condition in JSON Format}, { Sort Condition in JSON Format }, {Params Condition in JSON Format}, function (err, result) {
if (err) // do something
});
crud.sortByLimit( <collection-name>, {Read Condition in JSON Format}, { Sort Condition in JSON Format }, <skip-in-numbers>, <limit-in-numbers>, {Params Condition in JSON Format}, function (err, result) {
if (err) // do something
});
crud.aggregate( <collection-name>, <aggregate-condition>, function (err, result) {
if (err) // do something
});
crud.limit( <collection-name>, {Read Condition in JSON Format}, <skip-in-numbers>, <limit-in-numbers>, {Params Condition in JSON Format}, function (err, result) {
if (err) // do something
});