
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
devis-mongo-client
Advanced tools
A data storage plugin for Devisjs
This module supports the majority of necessary features for using your MongoDB database.
We should install Devis and the plugin :
$ npm install --save devis
$ npm install --save devis-mongo-client
Connect to the database :
.call({role:"mongodb", action:"connect"},{url:mongodb_url},callback);
.call({
role: "mongodb",
action: "connect"
}, { url: "mongodb://localhost:27017/foo" },callback);
Create a collection :
.call({role:"mongodb", action:"createCollection"},{collection:collection},callback);
Drop a collection :
.call({role:"mongodb", action:"dropCollection"},{collection:collection},callback);
Find data :
.call({role:"mongodb", action:"find"},{collection:collection, type:type, query: query, options: options},callback);
type : one or many (default : many);
//close is true by default, but if you don't wanan close the connection you should give false as argument
.call({role:"mongodb",action:"find"},{collection:"foo", type : "one", params:{"Acronym" : "L"},close:false},callback);
call({ role: "mongodb", action: "find" }, { type: "many", collection: "foo",query:{Name:"3"}, options: { fields: { "Acronym": 0, _id: 0 } } },callback);
Indexes :
.call({role:"mongodb", action:"index"},{collection:collection, type:type, indexFields: indexFields, params: params},callback);
type : ensureIndex or createIndex..call({role:"mongodb", action:"index"},{collection:collection, type:"ifExist", index: index},callback);
.call({role:"mongodb", action:"index"},{collection:collection, type:"getAllIndexes"},callback);
.call({role:"mongodb",action:"index"},{collection:"foo", type:"ifExist",index:["_id_","Acronym_1"],callback);
Insert data :
.call({role:"mongodb", action:"insert"},{collection:collection, type:type, data: data, params: params},callback);
type : one or many.
let data = [
{Value: "1",Name: "foo", Acronym:"foo1"},
{Value: "2",Name: "bar", Acronym:"bar1"}];
.call({ role: "mongodb", action: "insert" },{ type: "many",collection: "foo", data: data },callback);
Delete data :
.call({role:"mongodb", action:"delete"},{collection:collection, type:type, query: query},callback);
type : one or many.
.call({role:"mongodb",action:"delete"},{type:"deleteOne", collection:"foo",params:{Value: "1"}},,callback);
Update data :
.call({role:"mongodb", action:"update"},{collection:collection, type:type, query: query, data: data},callback);
type : one or many.
let queryOr={
$or:[{Value: "1"},{Value:"2"}]};
let newData={$set: { Name: "foobar"}};
.call({role:"mongodb", action:"update"},{ type: "many", collection: "foo",query:queryOr, data:newData},callback);
Aggregate functions :
.call({role:"mongodb", action:"aggregate"},{collection:collection, aggQuery: aggQuery},callback);
let aggQuery = [
{ "$match": { "date": "29.05.2017"} },
{
"$group": {
"_id": { "Key": "$Key", "date": "$date"},
"count": { "$sum": 1 }
}
}];
.call({ role: "mongodb", action: "aggregate" }, { collection: "Production",aggQuery:aggQuery },callback);
//Initialize a Devis instance
let devisMongoClient = require("devis")
//use the devis-mongo-client plugin
.plug("devis-mongo-client")
let promise = new Promise((resolve, reject) => {
//connect to the database
let promise = new Promise((resolve, reject) => {
devis.call({
role: "mongodb",
action: "connect"
}, {
url: "mongodb://localhost:27017/prisma"
}, (err, db) => {
if (err) reject(err);
else {
resolve("success");
}
});
});
promise.then((res) => {
//call find function of the plugin by giving the collection and search conditions
devisMongoClient.call({
role: "mongodb",
action: "find"
}, {
collection: "foo",
params: {
"Acronym": "L"
}
}, (err, result) => {
if (err) {
console.log(err);
} else {
console.log(result);
}
}
});
FAQs
a devis plugin for mongoDB
We found that devis-mongo-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.