
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
kriskowal's Q support for mongodb.
for mongoose, see mongoose-q.
WARNING!!! recent mongodb driver(>=1.9.20) is NOT fully supported. see issue #1
var mongodb = require('mongo-q')(require('mongodb'));
// verbose way: mongoQ is unused
var mongodb = require('mongodb'),
mongoQ = require('mongo-q')(mongodb)
// shortest way: mongodb will be loaded by mongo-q
var mongodb = require('mongo-q')();
mongodb.MongoClient.connectQ(....)
.then(function (db) {
return db.collectionQ('test');
})
.then(function (coll) {
return coll.findQ();
})
.then(function (cursor) {
return cursor.toArrayQ();
// workaround for mongodb >= 1.9.20
//return Q.nfcall(cursor.toArray);
})
.then(function (result) {
...
})
.fail(function (err) { ... })
.done();
mongodb.MongoClient.connectQ(....)
.then(function (db) {
return db.collectionQ('test');
})
.then(function (coll) {
return coll.find().toArrayQ(); // <----- HERE!
// workaround for mongodb >= 1.9.20
//return Q.nfcall(coll.find().toArray);
})
.then(function (result) {
...
})
.fail(function (err) { ... })
.done();
var mongodb = require('mongodb-q')(require('mongodb'), {prefix:'promiseOf_', suffix:'_withQ'});
mongodb.MongoClient.promiseOf_connect_withQ(...)
.then(function (db) {
return db.promiseOf_collection_withQ(...)
})
.then(function (coll) {
return coll.promiseOf_find_withQ();
})
.then(function (cursor) {
return cursor.promiseOf_toArray_withQ();
})
.then(function (result) {
...
})
.fail(function (err) { ... })
.done();
function customMapper(name) {
return 'q' + name.charAt(0).toUpperCase() + name.substring(1);
}
var mongodb = require('mongodb-q')(require('mongodb'), {mapper:customMapper});
mongodb.MongoClient.qConnect(...)
.then(function (db) { ...
return db.qCollection('test');
})
.then(function (coll) {
return coll.qFind();
})
.then(function (cursor) {
return cursor.toArray();
})
.then(function (result) {
...
})
.fail(function (err) { ... })
.done();
spread
:var mongodb = require('mongo-q')(require('mongodb'), {spread:true});
...
NOTE: at this time, mongodb client library is well formed enough. 'spread' option is needless.
That's all folks!
FAQs
kriskowal's Q support for mongodb
We found that mongo-q 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
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.