New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

sails-mongo

Package Overview
Dependencies
Maintainers
5
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sails-mongo - npm Package Compare versions

Comparing version 0.12.1 to 0.12.2

.editorconfig

4

CHANGELOG.md
# Sails-Mongo Changelog
### 0.12.2
* [BUG] Update mongo driver version picking up patches fixes issue with ssl connectivity which was resolved in mongodb[2.1.20]. See [#425](https://github.com/balderdashy/sails-mongo/issues/435) for more details.
### 0.12.1

@@ -4,0 +8,0 @@

13

lib/adapter.js

@@ -6,12 +6,13 @@ /*---------------------------------------------------------------

var util = require('util');
var async = require('async');
var _ = require('@sailshq/lodash');
var ObjectId = require('mongodb').ObjectID;
var Errors = require('waterline-errors').adapter;
var _runJoins = require('waterline-cursor');
var Connection = require('./connection');
var Collection = require('./collection');
var Errors = require('waterline-errors').adapter;
var ObjectId = require('mongodb').ObjectID;
var _runJoins = require('waterline-cursor');
var util = require('util');
var _ = require('lodash');
var utils = require('./utils');
var async = require('async');
module.exports = (function() {

@@ -18,0 +19,0 @@

@@ -1,2 +0,1 @@

/**

@@ -6,10 +5,11 @@ * Module dependencies

var _ = require('lodash'),
async = require('async'),
utils = require('./utils'),
Document = require('./document'),
Query = require('./query'),
ObjectId = require('mongodb').ObjectID,
Errors = require('waterline-errors').adapter;
var _ = require('@sailshq/lodash');
var async = require('async');
var ObjectId = require('mongodb').ObjectID;
var Errors = require('waterline-errors').adapter;
var utils = require('./utils');
var Document = require('./document');
var Query = require('./query');
/**

@@ -16,0 +16,0 @@ * Manage A Collection

@@ -1,2 +0,1 @@

/**

@@ -6,7 +5,8 @@ * Module Dependencies

var _ = require('lodash'),
ObjectId = require('mongodb').ObjectID,
utils = require('./utils'),
hasOwnProperty = utils.object.hasOwnProperty;
var _ = require('@sailshq/lodash');
var ObjectId = require('mongodb').ObjectID;
var utils = require('./utils');
var hasOwnProperty = utils.object.hasOwnProperty;
/**

@@ -75,9 +75,9 @@ * Document

if(_.isString(values.id) && values.id.match(/^[a-fA-F0-9]{24}$/)) {
values._id = new ObjectId.createFromHexString(values.id);
} else {
values._id = _.cloneDeep(values.id);
}
delete values.id;

@@ -84,0 +84,0 @@ };

@@ -6,8 +6,8 @@

var _ = require('lodash'),
ObjectId = require('mongodb').ObjectID,
Aggregate = require('./aggregate'),
utils = require('../utils'),
validator = require('validator'),
hop = utils.object.hasOwnProperty;
var _ = require('@sailshq/lodash');
var ObjectId = require('mongodb').ObjectID;
var validator = require('validator');
var Aggregate = require('./aggregate');
var utils = require('../utils');
var hop = utils.object.hasOwnProperty;

@@ -14,0 +14,0 @@ /**

@@ -6,7 +6,10 @@

var _ = require('lodash'),
ObjectId = require('mongodb').ObjectID,
MongoBinary = require('mongodb').Binary,
url = require('url');
var url = require('url');
var _ = require('@sailshq/lodash');
var mongodb = require('mongodb');
var ObjectId = mongodb.ObjectID;
var MongoBinary = mongodb.Binary;
/**

@@ -13,0 +16,0 @@ * ignore

{
"name": "sails-mongo",
"version": "0.12.1",
"version": "0.12.2",
"description": "Mongo DB adapter for Sails.js",

@@ -12,2 +12,3 @@ "main": "./lib/adapter.js",

"mongo",
"mongodb",
"orm",

@@ -46,13 +47,13 @@ "waterline",

"dependencies": {
"async": "1.5.2",
"lodash": "3.10.1",
"mongodb": "2.1.6",
"@sailshq/lodash": "3.10.2",
"async": "2.0.1",
"mongodb": "2.1.20",
"validator": "4.5.1",
"waterline-cursor": "~0.0.6",
"waterline-errors": "~0.10.1"
"waterline-cursor": "0.0.7",
"waterline-errors": "0.10.1"
},
"devDependencies": {
"captains-log": "~0.11.11",
"mocha": "2.4.1",
"waterline-adapter-tests": "~0.11.1"
"captains-log": "^1.0.2",
"mocha": "3.0.2",
"waterline-adapter-tests": "~0.12.1"
},

@@ -59,0 +60,0 @@ "waterlineAdapter": {

@@ -1,10 +0,9 @@

[![](https://camo.githubusercontent.com/9e49073459ed4e0e2687b80eaf515d87b0da4a6b/687474703a2f2f62616c64657264617368792e6769746875622e696f2f7361696c732f696d616765732f6c6f676f2e706e67)](http://sailsjs.org/#!)
[![](https://camo.githubusercontent.com/9e49073459ed4e0e2687b80eaf515d87b0da4a6b/687474703a2f2f62616c64657264617368792e6769746875622e696f2f7361696c732f696d616765732f6c6f676f2e706e67)](http://sailsjs.com)
# sails-mongo
[![Build Status](https://travis-ci.org/balderdashy/sails-mongo.svg?branch=master)](https://travis-ci.org/balderdashy/sails-mongo)
[![npm version](https://badge.fury.io/js/sails-mongo.svg)](http://badge.fury.io/js/sails-mongo)
[![Dependency Status](https://david-dm.org/balderdashy/sails-mongo.svg)](https://david-dm.org/balderdashy/sails-mongo)
Waterline adapter for MongoDB.
Sails.js/Waterline adapter for MongoDB.
> **Heads up**

@@ -15,2 +14,3 @@ >

## Installation

@@ -24,12 +24,17 @@

## Sails Configuration
## Usage
### Using with Sails v0.11.x (>= 0.10.x)
> Note: The following instructions are for apps using at least Sails v0.10.x, up through v0.12.x.
> + For help with legacy versions of Sails, see [#Legacy Usage](#Legacy-usage) below.
> + 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).
Add the following config to the `config/connections.js` file:
After 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:
```javascript
// config/connections.js
module.exports.connections = {
someMongoDb: {
localMongoDb: {
adapter: 'sails-mongo',

@@ -42,37 +47,83 @@ host: 'localhost', // defaults to `localhost` if omitted

}
};
```
And set this particular mongo database as your default in `config/models.js`:
```js
// config/models.js
module.exports.models = {
'connection': 'someMongoDb'
'connection': 'localMongoDb'
};
```
#### What about mongo urls?
> For more information about configuring datastores in your Sails app, click [here](http://sailsjs.com/documentation/reference/config/sails-config-connections).
Alternatively, you can specify your Mongo configuration as a URL, e.g.:
#### What about production?
In production, use config/env/production.js and/or environment variables.
> For more about getting your Sails app ready for production, see [**Concepts > Deployment**](http://sailsjs.com/documentation/concepts/deployment).
## Bugs   [![NPM version](https://badge.fury.io/js/sails-mongo.svg)](http://npmjs.com/package/sails-mongo)
To report a bug, [click here](http://sailsjs.com/bugs).
## Help
If you have questions or need help, click [here](http://sailsjs.com/support).
## FAQ
#### What about MongoDB urls?
You can follow [MongoDB URI Connection Settings](https://docs.mongodb.com/manual/reference/connection-string/) specification on how to define a connection string URI.
Following there is an example on how to configure the connection to your MongoDB server using a URL. e.g.:
```js
module.exports.connections = {
someMongoDb: {
localMongoDb: {
adapter: 'sails-mongo',
url: process.env.MONGOLAB_URI
url: 'mongodb://heroku_12345678:random_password@ds029017.mLab.com:29017/heroku_12345678'
}
};
```
You 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:
```js
module.exports.connections = {
localMongoDb: {
adapter: 'sails-mongo',
url: process.env.MONGODB_URI
}
};
```
This would be useful if, for instance, your Heroku env variables looked like:
```bash
MONGOLAB_URI=mongodb://heroku_app33429348:o9dag2076pnj70p8iqmaj2fiaq@049641.mongolab.com:49641/heroku_app33429348
MONGODB_URI=mongodb://heroku_12345678:random_password@ds029017.mLab.com:29017/heroku_12345678
```
It must be noted though, that if you provide a `url` configuration, then, `database`, `user`, `password`, `host` and `port` configuration options are ignored.
### Legacy usage
#### What about a MongoDB deployment that is part of a Replica Set?
For example:
```bash
MONGODB_URI=mongodb://mongodbserver01:27017,mongodbserver02:27017,mongodbserver03:27017/my-app-datatabase?replSet=my-replica-set-name&readPreference=nearest&slaveOk=true
```
The 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`
## Legacy usage
####Using with Sails v0.9.x

@@ -136,31 +187,28 @@

Don't forget that Mongo uses the ObjectId type for ids.
> Don't forget that Mongo uses the ObjectId type for ids.
## Sails.js
http://sailsjs.org
## Waterline
## Contributing   [![Dependency Status](https://david-dm.org/balderdashy/sails-mongo.svg)](https://david-dm.org/balderdashy/sails-mongo)   [![Build Status](https://travis-ci.org/balderdashy/sails-mongo.svg?branch=master)](https://travis-ci.org/balderdashy/sails-mongo)   [![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)
[Waterline](https://github.com/balderdashy/waterline) is a brand new kind of storage and retrieval engine.
Please observe the guidelines and conventions laid out in the [Sails project contribution guide](http://sailsjs.com/contribute) when opening issues or submitting pull requests.
It provides a uniform API for accessing stuff from different kinds of databases, protocols, and 3rd party APIs. That means you write the same code to get users, whether they live in MySQL, LDAP, MongoDB, or Facebook.
[![NPM](https://nodei.co/npm/sails-mongo.png?downloads=true)](http://npmjs.com/package/sails-mongo)
## Contributors
#### Special thanks
Thanks so much to Ted Kulp ([@tedkulp](https://twitter.com/tedkulp)) and Robin Persson ([@prssn](https://twitter.com/prssn)) for building this adapter.
Thanks 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.
## Sails.js License
### The MIT License (MIT)
## License
Copyright © 2012-2015 Mike McNeil & contributors
MIT
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
© 2013 Ted Kulp, Robin Persson, Cody Stoltman, Mike McNeil, Balderdash Design Co.
© 2014 Balderdash Design Co.
© 2015-2016 The Treeline Co.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Like the [Sails framework](http://sailsjs.com), this adapter is free and open-source under the [MIT License](http://sailsjs.com/license).
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@@ -1,6 +0,6 @@

var Adapter = require('../../lib/adapter'),
Config = require('../support/config'),
Fixture = require('../support/fixture'),
assert = require('assert'),
async = require('async');
var assert = require('assert');
var async = require('async');
var Adapter = require('../../lib/adapter');
var Config = require('../support/config');
var Fixture = require('../support/fixture');

@@ -17,7 +17,7 @@ var CONNECTIONS = 10000;

Adapter.registerCollection({ identity: 'test', config: Config }, function(err) {
if(err) done(err);
if(err) { return done(err); }
// Define The Collection
Adapter.define('test', Fixture, function(err, schema) {
if(err) return done(err);
if(err) { return done(err); }
Schema = schema;

@@ -44,4 +44,6 @@ done();

}, function(err, users) {
assert(!err);
assert(users.length === CONNECTIONS);
try {
assert(!err,err);
assert(users.length === CONNECTIONS, 'expected '+CONNECTIONS+' users but instead got '+users.length);
} catch (e) { return done(e); }
done();

@@ -48,0 +50,0 @@ });

@@ -0,4 +1,4 @@

var assert = require('assert');
var _ = require('@sailshq/lodash');
var Query = require('../../lib/query');
var assert = require('assert');
var _ = require('lodash');

@@ -5,0 +5,0 @@ describe('Query', function() {

@@ -1,6 +0,7 @@

var Query = require('../../../lib/query');
var assert = require('assert');
var _ = require('lodash');
var _ = require('@sailshq/lodash');
var ObjectID = require('mongodb').ObjectID;
var Query = require('../../../lib/query');
describe('Query', function () {

@@ -7,0 +8,0 @@ "use strict";

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc