{"_id":"@djowinz/sails-mongo","_rev":"9-4465fca9dbfbb8c32c6bc7c2b47fffbc","name":"@djowinz/sails-mongo","time":{"modified":"2022-06-12T17:06:19.427Z","created":"2017-04-20T04:49:02.541Z","0.13.0":"2017-04-20T04:49:02.541Z","0.13.1":"2017-04-20T04:54:03.339Z","0.13.2":"2017-04-20T04:58:55.723Z","0.13.3":"2017-04-20T05:09:15.921Z","0.13.4":"2017-04-20T05:11:58.116Z"},"maintainers":[{"email":"dyllen.owens@djove.com","name":"djowinz"}],"dist-tags":{"latest":"0.13.4"},"description":"Mongo DB adapter for Sails.js","readme":"[![](https://camo.githubusercontent.com/9e49073459ed4e0e2687b80eaf515d87b0da4a6b/687474703a2f2f62616c64657264617368792e6769746875622e696f2f7361696c732f696d616765732f6c6f676f2e706e67)](http://sailsjs.com)\n\n# sails-mongo\n[![npm version](https://badge.fury.io/js/sails-mongo.svg)](http://badge.fury.io/js/sails-mongo)\n\nSails.js/Waterline adapter for MongoDB.\n\n\n> **Heads up**\n>\n> `sails-mongo` maps the logical `id` attribute to the required `_id` physical-layer mongo id.\n> In the current version of `sails-mongo`, you **should not** sort by `id`.\n\n\n## Installation\n\nInstall from NPM.\n\n```bash\n$ npm install sails-mongo --save\n```\n\n## Usage\n\n> Note: The following instructions are for apps using at least Sails v0.10.x, up through v0.12.x.\n> + For help with legacy versions of Sails, see [#Legacy Usage](#Legacy-usage) below.\n> + To use sails-mongo with the Sails v1 / Waterline 0.13 prerelease, see [the 1.0 branch of sails-docs](https://github.com/balderdashy/sails-docs/tree/1.0).\n\n\nAfter installing this adapter as a dependency of your Sails app, make this particular Mongo database your default datastore by adding the following settings to the files in your config folder:\n\n\n```javascript\n// config/connections.js\nmodule.exports.connections = {\n\n  localMongoDb: {\n    adapter: 'sails-mongo',\n    host: 'localhost', // defaults to `localhost` if omitted\n    port: 27017, // defaults to 27017 if omitted\n    user: 'username_here', // or omit if not relevant\n    password: 'password_here', // or omit if not relevant\n    database: 'database_name_here' // or omit if not relevant\n  }\n\n};\n```\n\n```js\n// config/models.js\nmodule.exports.models = {\n  'connection': 'localMongoDb'\n};\n```\n\n> For more information about configuring datastores in your Sails app, click [here](http://sailsjs.com/documentation/reference/config/sails-config-connections).\n\n#### What about production?\nIn production, use config/env/production.js and/or environment variables.\n\n> For more about getting your Sails app ready for production, see [**Concepts > Deployment**](http://sailsjs.com/documentation/concepts/deployment).\n\n\n## Bugs &nbsp; [![NPM version](https://badge.fury.io/js/sails-mongo.svg)](http://npmjs.com/package/sails-mongo)\n\nTo report a bug, [click here](http://sailsjs.com/bugs).\n\n\n## Help\n\nIf you have questions or need help, click [here](http://sailsjs.com/support).\n\n\n## FAQ\n\n#### What about MongoDB urls?\n\nYou can follow [MongoDB URI Connection Settings](https://docs.mongodb.com/manual/reference/connection-string/) specification on how to define a connection string URI.\n\nFollowing there is an example on how to configure the connection to your MongoDB server using a URL. e.g.:\n\n```js\nmodule.exports.connections = {\n\n  localMongoDb: {\n    adapter: 'sails-mongo',\n    url: 'mongodb://heroku_12345678:random_password@ds029017.mLab.com:29017/heroku_12345678'\n  }\n};\n```\nYou could also use an environment variable, to ease your deployments, for example, to [Heroku](https://devcenter.heroku.com/articles/mongolab#getting-your-connection-uri) , as follows:\n\n```js\nmodule.exports.connections = {\n\n  localMongoDb: {\n    adapter: 'sails-mongo',\n    url: process.env.MONGODB_URI\n  }\n};\n```\n\nThis would be useful if, for instance, your Heroku env variables looked like:\n\n```bash\nMONGODB_URI=mongodb://heroku_12345678:random_password@ds029017.mLab.com:29017/heroku_12345678\n```\n\nIt must be noted though, that if you provide a `url` configuration, then, `database`, `user`, `password`, `host` and `port` configuration options are ignored.\n\n\n#### What about a MongoDB deployment that is part of a Replica Set?\n\nFor example:\n\n```bash\nMONGODB_URI=mongodb://mongodbserver01:27017,mongodbserver02:27017,mongodbserver03:27017/my-app-datatabase?replSet=my-replica-set-name&readPreference=nearest&slaveOk=true\n```\n\nThe previous configuration will set three MongoDB servers, named `mongodbserver01`, `mongodbserver02` and `mongodbserver03`, all using port `27017`, connecting to the `my-app-database` and using `my-replica-set-name` as the replica set. It also sets the `readPreference` to `nearest` and allows slave connections, with `slaveOk` set to `true`\n\n\n\n## Legacy usage\n\n####Using with Sails v0.9.x\n\nAdd the mongo config to the `config/adapters.js` file.\n\n```javascript\nmodule.exports.adapters = {\n  'default': 'mongo',\n\n  mongo: {\n    module: 'sails-mongo',\n    host: 'localhost',\n    port: 27017,\n    user: 'username',\n    password: 'password',\n    database: 'your mongo db name here',\n    wlNext: {\n      caseSensitive: false\n    }\n  }\n};\n```\n\n*Note: You can also use the old `v0.8.x` syntax as well, see next section for details.*\n\nReplication/Replica Set can be setup by adding the following options to the `mongo` object,\nwith your own replica details specified:\n\n```javascript\nreplSet: {\n  servers: [\n    {\n      host: 'secondary1.localhost',\n      port: 27017 // Will override port from default config (optional)\n    },\n    {\n      host: 'secondary2.localhost',\n      port: 27017\n    }\n  ],\n  options: {} // See http://mongodb.github.io/node-mongodb-native/api-generated/replset.html (optional)\n}\n```\n\n*Note: Replica set configuration is optional.*\n\n#### Using with Sails v0.8.x\n\n```javascript\nmodule.exports.adapters = {\n  'default': 'mongo',\n\n  mongo: {\n    module: 'sails-mongo',\n    url: 'mongodb://USER:PASSWORD@HOST:PORT/DB'\n  }\n};\n```\n\n> Don't forget that Mongo uses the ObjectId type for ids.\n\n\n\n## Contributing &nbsp; [![Dependency Status](https://david-dm.org/balderdashy/sails-mongo.svg)](https://david-dm.org/balderdashy/sails-mongo) &nbsp; [![Build Status](https://travis-ci.org/balderdashy/sails-mongo.svg?branch=master)](https://travis-ci.org/balderdashy/sails-mongo) &nbsp; [![Build status on Windows](https://ci.appveyor.com/api/projects/status/u0i1o62tsw6ymbjd/branch/master?svg=true)](https://ci.appveyor.com/project/mikermcneil/sails-mongo/branch/master)\n\nPlease observe the guidelines and conventions laid out in the [Sails project contribution guide](http://sailsjs.com/documentation/contributing) when opening issues or submitting pull requests.\n\n[![NPM](https://nodei.co/npm/sails-mongo.png?downloads=true)](http://npmjs.com/package/sails-mongo)\n\n\n#### Special thanks\n\nThanks so much to Ted Kulp ([@tedkulp](https://twitter.com/tedkulp)) and Robin Persson ([@prssn](https://twitter.com/prssn)) for building the first version of this adapter back in 2013.  Since then, it has evolved into a core adapter within the framework.\n\n\n\n## License\n\nMIT\n\n&copy; 2013 Ted Kulp, Robin Persson, Cody Stoltman, Mike McNeil, Balderdash Design Co.\n&copy; 2014 Balderdash Design Co.\n&copy; 2015-2016 The Treeline Co.\n\nLike the [Sails framework](http://sailsjs.com), this adapter is free and open-source under the [MIT License](http://sailsjs.com/license).\n\n","versions":{"0.13.1":{"name":"@djowinz/sails-mongo","version":"0.13.1","description":"Mongo DB adapter for Sails.js","main":"./lib/adapter.js","scripts":{"test":"make test","docker":"docker-compose run adapter bash"},"keywords":["mongo","mongodb","orm","waterline","sails"],"contributors":[{"name":"Cody Stoltman","email":"particlebanana@gmail.com"},{"name":"Zolmeister","email":"zolikahan@gmail.com"},{"name":"Robin Persson","email":"rprssn@gmail.com"},{"name":"Ted Kulp","email":"github@wishy.org"},{"name":"Andy Pham","email":"andyphamhung@gmail.com"}],"license":"MIT","repository":{"type":"git","url":"git://github.com/balderdashy/sails-mongo.git"},"dependencies":{"@sailshq/lodash":"^3.10.2","async":"2.0.1","mongodb":"2.2.22","validator":"4.5.1","waterline-cursor":"0.0.7","waterline-errors":"0.10.1"},"devDependencies":{"captains-log":"^1.0.2","mocha":"3.0.2","waterline-adapter-tests":"~0.12.1"},"waterlineAdapter":{"waterlineVersion":"~0.10.0","interfaces":["semantic","queryable","associations"],"features":["cross-adapter"]},"gitHead":"34d3560bc2ab16849c656dfc8608bcd0f9df0aec","bugs":{"url":"https://github.com/balderdashy/sails-mongo/issues"},"homepage":"https://github.com/balderdashy/sails-mongo#readme","_id":"@djowinz/sails-mongo@0.13.1","_shasum":"80871bde301556dc8f473f35c85d0a10afb61327","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.5.0","_npmUser":{"name":"djove","email":"dyllen.owens@djove.com"},"dist":{"shasum":"80871bde301556dc8f473f35c85d0a10afb61327","tarball":"https://registry.npmjs.org/@djowinz/sails-mongo/-/sails-mongo-0.13.1.tgz","integrity":"sha512-djnvtGE71ZCVMuYhaXhKTHMixMdF8tO5L6HyIADMz6jcYCzULXyYZhTxxPtbgmZnwR+XZjmO2WCFko3Xt0/55w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHcaZJPzDiSW3kJnwbJY2Y9xs/qItp6RvYz+1DqlO49CAiEAjB+hZ3R654OyCLnLZ7sn6PTAjvByxQkeaGCsKxM84/E="}]},"maintainers":[{"name":"djove","email":"dyllen.owens@djove.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/sails-mongo-0.13.1.tgz_1492664043119_0.29151769797317684"},"directories":{}},"0.13.2":{"name":"@djowinz/sails-mongo","version":"0.13.2","description":"Mongo DB adapter for Sails.js","main":"./lib/adapter.js","scripts":{"test":"make test","docker":"docker-compose run adapter bash"},"keywords":["mongo","mongodb","orm","waterline","sails"],"contributors":[{"name":"Cody Stoltman","email":"particlebanana@gmail.com"},{"name":"Zolmeister","email":"zolikahan@gmail.com"},{"name":"Robin Persson","email":"rprssn@gmail.com"},{"name":"Ted Kulp","email":"github@wishy.org"},{"name":"Andy Pham","email":"andyphamhung@gmail.com"}],"license":"MIT","repository":{"type":"git","url":"git://github.com/balderdashy/sails-mongo.git"},"dependencies":{"@sailshq/lodash":"^3.10.2","async":"2.0.1","mongodb":"2.2.22","validator":"4.5.1","waterline-cursor":"0.0.7","waterline-errors":"0.10.1"},"devDependencies":{"captains-log":"^1.0.2","mocha":"3.0.2","waterline-adapter-tests":"~0.12.1"},"waterlineAdapter":{"waterlineVersion":"~0.10.0","interfaces":["semantic","queryable","associations"],"features":["cross-adapter"]},"gitHead":"c867fd62ab63b6759f9ff63d48902147e8a070cf","bugs":{"url":"https://github.com/balderdashy/sails-mongo/issues"},"homepage":"https://github.com/balderdashy/sails-mongo#readme","_id":"@djowinz/sails-mongo@0.13.2","_shasum":"f94018a79a75f837c9dd9f5fb8f35c7579a4aaa6","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.5.0","_npmUser":{"name":"djove","email":"dyllen.owens@djove.com"},"dist":{"shasum":"f94018a79a75f837c9dd9f5fb8f35c7579a4aaa6","tarball":"https://registry.npmjs.org/@djowinz/sails-mongo/-/sails-mongo-0.13.2.tgz","integrity":"sha512-k4c8s7fTe+qgujta+WxFug/UbrP9zUJuID8RZm8x5UQvHGFf0j1okHHeBBxpzOV2uo2rKdvn6e33LzoVHdpxcw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHD3W2M3P41Gl3Gu94DyzxTcqiY+aSDHjVyGnCrxGWPJAiEAzi3jr5EaYIBK3iqZMB7WnHqTtCaYXEyvox6gbVuYWtg="}]},"maintainers":[{"name":"djove","email":"dyllen.owens@djove.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/sails-mongo-0.13.2.tgz_1492664335487_0.5398853884544224"},"directories":{}},"0.13.3":{"name":"@djowinz/sails-mongo","version":"0.13.3","description":"Mongo DB adapter for Sails.js","main":"./lib/adapter.js","scripts":{"test":"make test","docker":"docker-compose run adapter bash"},"keywords":["mongo","mongodb","orm","waterline","sails"],"contributors":[{"name":"Cody Stoltman","email":"particlebanana@gmail.com"},{"name":"Zolmeister","email":"zolikahan@gmail.com"},{"name":"Robin Persson","email":"rprssn@gmail.com"},{"name":"Ted Kulp","email":"github@wishy.org"},{"name":"Andy Pham","email":"andyphamhung@gmail.com"}],"license":"MIT","repository":{"type":"git","url":"git://github.com/balderdashy/sails-mongo.git"},"dependencies":{"@sailshq/lodash":"^3.10.2","async":"2.0.1","mongodb":"2.2.22","validator":"4.5.1","waterline-cursor":"0.0.7","waterline-errors":"0.10.1"},"devDependencies":{"captains-log":"^1.0.2","mocha":"3.0.2","waterline-adapter-tests":"~0.12.1"},"waterlineAdapter":{"waterlineVersion":"~0.10.0","interfaces":["semantic","queryable","associations"],"features":["cross-adapter"]},"gitHead":"4e7b097af25507f88ff122df83724a2168ad383c","bugs":{"url":"https://github.com/balderdashy/sails-mongo/issues"},"homepage":"https://github.com/balderdashy/sails-mongo#readme","_id":"@djowinz/sails-mongo@0.13.3","_shasum":"d012361a76f5060eda19454af9b291c6e5e4d287","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.5.0","_npmUser":{"name":"djove","email":"dyllen.owens@djove.com"},"dist":{"shasum":"d012361a76f5060eda19454af9b291c6e5e4d287","tarball":"https://registry.npmjs.org/@djowinz/sails-mongo/-/sails-mongo-0.13.3.tgz","integrity":"sha512-RqFYL1tVsdgbdAt4+FwmPAo7IokpAJJNuUdL1X+iobSs6o/29XXMYpcZ8j3hgEbijY+Zv6NgbBpwDMNLgeeF3A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFz3Fgb+rpT35qYLDIn+6dW/pI9VUyaqebz1UPU+mQoCAiEAxJlzx/P5KQElzWNyF03CX+SLndAQiusvggvIpIM58/0="}]},"maintainers":[{"name":"djove","email":"dyllen.owens@djove.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/sails-mongo-0.13.3.tgz_1492664954072_0.8803984040860087"},"directories":{}},"0.13.4":{"name":"@djowinz/sails-mongo","version":"0.13.4","description":"Mongo DB adapter for Sails.js","main":"./lib/adapter.js","scripts":{"test":"make test","docker":"docker-compose run adapter bash"},"keywords":["mongo","mongodb","orm","waterline","sails"],"contributors":[{"name":"Cody Stoltman","email":"particlebanana@gmail.com"},{"name":"Zolmeister","email":"zolikahan@gmail.com"},{"name":"Robin Persson","email":"rprssn@gmail.com"},{"name":"Ted Kulp","email":"github@wishy.org"},{"name":"Andy Pham","email":"andyphamhung@gmail.com"}],"license":"MIT","repository":{"type":"git","url":"git://github.com/balderdashy/sails-mongo.git"},"dependencies":{"@sailshq/lodash":"^3.10.2","async":"2.0.1","mongodb":"2.2.22","validator":"4.5.1","waterline-cursor":"0.0.7","waterline-errors":"0.10.1"},"devDependencies":{"captains-log":"^1.0.2","mocha":"3.0.2","waterline-adapter-tests":"~0.12.1"},"waterlineAdapter":{"waterlineVersion":"~0.10.0","interfaces":["semantic","queryable","associations"],"features":["cross-adapter"]},"gitHead":"1cd9683d15d7e294b868f7fb228bdd79fec60801","bugs":{"url":"https://github.com/balderdashy/sails-mongo/issues"},"homepage":"https://github.com/balderdashy/sails-mongo#readme","_id":"@djowinz/sails-mongo@0.13.4","_shasum":"5965467517eca9017a7b51bc00718f7d91fa062e","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.5.0","_npmUser":{"name":"djove","email":"dyllen.owens@djove.com"},"dist":{"shasum":"5965467517eca9017a7b51bc00718f7d91fa062e","tarball":"https://registry.npmjs.org/@djowinz/sails-mongo/-/sails-mongo-0.13.4.tgz","integrity":"sha512-yDRAxHj9qInKGsCHIxNpNgn6NFrYWJmW+SPEDS5b1qcQDsQpbr1iDDfrFwKcTNYuT1ZPjhfZwhwoNTRWEy5Zww==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAWFFZfDTQ6EUmsiWfrpmIbu/5v4rSCYdVIjjaZ1SY+dAiBMuPPUhL5oJTjRG8di9qwIGlRsCut+pYbUL+VEqW5Ozg=="}]},"maintainers":[{"name":"djove","email":"dyllen.owens@djove.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/sails-mongo-0.13.4.tgz_1492665117898_0.3751242281869054"},"directories":{}}},"homepage":"https://github.com/balderdashy/sails-mongo#readme","keywords":["mongo","mongodb","orm","waterline","sails"],"repository":{"type":"git","url":"git://github.com/balderdashy/sails-mongo.git"},"contributors":[{"name":"Cody Stoltman","email":"particlebanana@gmail.com"},{"name":"Zolmeister","email":"zolikahan@gmail.com"},{"name":"Robin Persson","email":"rprssn@gmail.com"},{"name":"Ted Kulp","email":"github@wishy.org"},{"name":"Andy Pham","email":"andyphamhung@gmail.com"}],"bugs":{"url":"https://github.com/balderdashy/sails-mongo/issues"},"license":"MIT","readmeFilename":"README.md"}