{"id":28466272,"url":"https://github.com/iolo/mongo-q","last_synced_at":"2025-06-29T21:32:29.535Z","repository":{"id":57314468,"uuid":"13378163","full_name":"iolo/mongo-q","owner":"iolo","description":"**DEPRECATED** kriskowal's Q support for mongodb","archived":false,"fork":false,"pushed_at":"2015-12-28T08:53:22.000Z","size":10,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-07T06:08:48.099Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iolo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-10-07T08:05:16.000Z","updated_at":"2016-12-12T19:46:08.000Z","dependencies_parsed_at":"2022-09-20T23:20:54.496Z","dependency_job_id":null,"html_url":"https://github.com/iolo/mongo-q","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/iolo/mongo-q","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iolo%2Fmongo-q","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iolo%2Fmongo-q/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iolo%2Fmongo-q/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iolo%2Fmongo-q/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iolo","download_url":"https://codeload.github.com/iolo/mongo-q/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iolo%2Fmongo-q/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262671681,"owners_count":23346452,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-07T06:08:50.197Z","updated_at":"2025-06-29T21:32:29.508Z","avatar_url":"https://github.com/iolo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"mongo-q\n=======\n\n\u003e **DEPRECATED** [ES6 Promise is supported](http://mongodb.github.io/node-mongodb-native/2.0/reference/ecmascript6/) by [official mongodb node.js driver](https://github.com/mongodb/node-mongodb-native/).\n\n[kriskowal's Q](http://documentup.com/kriskowal/q/) support for [mongodb](https://github.com/mongodb/node-mongodb-native/).\n\nfor [mongoose](http://mongoosejs.com), see [mongoose-q](http://github.com/iolo/mongoose-q).\n\n\u003e WARNING!!!\n\u003e recent mongodb driver(\u003e=1.9.20) is **NOT** fully supported. see issue #1\n\nusage\n-----\n\n* to apply Q with default suffix 'Q':\n\n```javascript\nvar mongodb = require('mongo-q')(require('mongodb'));\n// verbose way: mongoQ is unused\nvar mongodb = require('mongodb'),\n    mongoQ = require('mongo-q')(mongodb)\n// shortest way: mongodb will be loaded by mongo-q\nvar mongodb = require('mongo-q')();\n```\n\n* use Q-applied mongodb client library:\n\n```javascript\nmongodb.MongoClient.connectQ(....)\n  .then(function (db) {\n    return db.collectionQ('test');\n  })\n  .then(function (coll) {\n    return coll.findQ();\n  })\n  .then(function (cursor) {\n    return cursor.toArrayQ();\n    // workaround for mongodb \u003e= 1.9.20\n    //return Q.nfcall(cursor.toArray);\n  })\n  .then(function (result) {\n    ...\n  })\n  .fail(function (err) { ... })\n  .done();\n```\n\n* you can mix them:\n\n```javascript\nmongodb.MongoClient.connectQ(....)\n  .then(function (db) {\n    return db.collectionQ('test');\n  })\n  .then(function (coll) {\n    return coll.find().toArrayQ(); // \u003c----- HERE!\n    // workaround for mongodb \u003e= 1.9.20\n    //return Q.nfcall(coll.find().toArray);\n  })\n  .then(function (result) {\n    ...\n  })\n  .fail(function (err) { ... })\n  .done();\n```\n\n* to apply Q with custom suffix/prefix:\n\n```javascript\nvar mongodb = require('mongodb-q')(require('mongodb'), {prefix:'promiseOf_', suffix:'_withQ'});\nmongodb.MongoClient.promiseOf_connect_withQ(...)\n  .then(function (db) {\n    return db.promiseOf_collection_withQ(...)\n  })\n  .then(function (coll) {\n    return coll.promiseOf_find_withQ();\n  })\n  .then(function (cursor) {\n    return cursor.promiseOf_toArray_withQ();\n  })\n  .then(function (result) {\n    ...\n  })\n  .fail(function (err) { ... })\n  .done();\n```\n\n* to apply Q with custom name mapper:\n\n```javascript\nfunction customMapper(name) {\n  return 'q' + name.charAt(0).toUpperCase() + name.substring(1);\n}\nvar mongodb = require('mongodb-q')(require('mongodb'), {mapper:customMapper});\nmongodb.MongoClient.qConnect(...)\n  .then(function (db) { ... \n    return db.qCollection('test');\n  })\n  .then(function (coll) {\n    return coll.qFind();\n  })\n  .then(function (cursor) {\n    return cursor.toArray();\n  })\n  .then(function (result) {\n    ...\n  })\n  .fail(function (err) { ... })\n  .done();\n```\n\n* to apply Q with ```spread```:\n\n```javascript\nvar mongodb = require('mongo-q')(require('mongodb'), {spread:true});\n...\n```\n\n\u003e NOTE: at this time, mongodb client library is well formed enough. 'spread' option is needless.\n\nThat's all folks!\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiolo%2Fmongo-q","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiolo%2Fmongo-q","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiolo%2Fmongo-q/lists"}