Comparing version 0.2.13 to 0.2.14
@@ -71,3 +71,3 @@ /** | ||
} | ||
server = new mongodb.ReplSetServers(sets, {rs_name: s.rs}); | ||
server = new mongodb.ReplSet(sets, {rs_name: s.rs}); | ||
@@ -82,18 +82,31 @@ } else { | ||
} | ||
if (s.username && s.password) { | ||
var t = this; | ||
client.authenticate(s.username, s.password, function (err, result) { | ||
t.client = client; | ||
schema.client = client; | ||
callback(); | ||
}); | ||
} else { | ||
this.client = client; | ||
schema.client = client; | ||
callback(); | ||
} | ||
this.client = client; | ||
this.schema = schema; | ||
this.connection() | ||
.then(callback); | ||
}.bind(this)); | ||
} | ||
MongoDB.prototype.connection = function () { | ||
var t = this; | ||
return new Promise(function(resolve, reject) { | ||
if (t.s.username && t.s.password) { | ||
t.client.authenticate(t.s.username, t.s.password, function (err, result) { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
t.schema.client = t.client; | ||
resolve(); | ||
} | ||
}); | ||
} else { | ||
t.schema.client = t.client; | ||
setImmediate(resolve); | ||
} | ||
}); | ||
}; | ||
MongoDB.prototype.define = function (descr) { | ||
@@ -104,3 +117,3 @@ if (!descr.settings) | ||
this._models[descr.model.modelName] = descr; | ||
setTimeout(function () { | ||
this.connection().then(function() { | ||
Object.keys(descr.properties).forEach(function (k) { | ||
@@ -117,3 +130,3 @@ if (typeof descr.properties[k].index !== 'undefined' || typeof descr.properties[k].unique !== 'undefined') { | ||
}); | ||
}, 1000); | ||
}); | ||
}; | ||
@@ -120,0 +133,0 @@ |
@@ -37,3 +37,3 @@ /** | ||
} else { | ||
schema.client = mongoose.connectSet(schema.settings.url, { | ||
schema.client = mongoose.createConnection(schema.settings.url, { | ||
rs_name: schema.settings.rs | ||
@@ -40,0 +40,0 @@ }); |
@@ -769,3 +769,3 @@ /** | ||
field.push(datatype(p)); | ||
field.push(p.allowNull === false || (typeof p['default'] !== 'undefined' && acceptedDefaults(p)) ? 'NOT NULL' : 'NULL'); | ||
field.push(p.allowNull === false || p['null'] === false ? 'NOT NULL' : 'NULL'); | ||
if (typeof p['default'] !== 'undefined' && acceptedDefaults(p) && typeof p['default'] !== 'function') { | ||
@@ -956,2 +956,2 @@ field.push('DEFAULT ' + getDefaultValue(p)); | ||
} | ||
} | ||
} |
@@ -192,5 +192,11 @@ /** | ||
var sql = 'SELECT ' + this.getColumns(model) + ' FROM ' | ||
+ this.tableEscaped(model) + ' ' | ||
+ this.toFilter(model, filter); | ||
if(filter.fields === undefined) { | ||
var sql = 'SELECT ' + this.getColumns(model) + ' FROM ' | ||
+ this.tableEscaped(model) + ' ' | ||
+ this.toFilter(model, filter); | ||
} else { | ||
var sql = 'SELECT ' + filter.fields + ' FROM ' | ||
+ this.tableEscaped(model) + ' ' | ||
+ this.toFilter(model, filter); | ||
} | ||
@@ -197,0 +203,0 @@ this.query(sql, function (err, data) { |
{ | ||
"name": "caminte", | ||
"description": "ORM for every database: redis, mysql, neo4j, mongodb, rethinkdb, postgres, sqlite, tingodb", | ||
"version": "0.2.13", | ||
"version": "0.2.14", | ||
"author": { | ||
@@ -104,2 +104,3 @@ "name": "Aleksej Gordejev", | ||
"dependencies": { | ||
"bluebird": "^3.4.6", | ||
"node-uuid": ">= 1.3.3" | ||
@@ -106,0 +107,0 @@ }, |
@@ -208,4 +208,4 @@ [![Build Status](https://travis-ci.org/biggora/caminte.png?branch=master)](https://travis-ci.org/biggora/caminte) | ||
- [TrinteJS - Javascrpt MVC Framework for Node.JS](http://www.trintejs.com/) | ||
- [Cross-db Session Storage for ExpressJS](https://github.com/biggora/express-mongodb) | ||
- [MongoDB Session Storage for ExpressJS](https://github.com/biggora/connect-caminte) | ||
- [Cross-db Session Storage for ExpressJS](https://github.com/biggora/connect-caminte) | ||
- [MongoDB Session Storage for ExpressJS](https://github.com/biggora/express-mongodb) | ||
- [Middleware exposing user-agent for NodeJS](https://github.com/biggora/express-useragent) | ||
@@ -212,0 +212,0 @@ - [Uploading files middleware for NodeJS](https://github.com/biggora/express-uploader) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13904
700314
2
+ Addedbluebird@^3.4.6
+ Addedbluebird@3.7.2(transitive)