Comparing version 0.2.4 to 0.2.5
22
index.js
@@ -6,16 +6,10 @@ var mongo = require('mongodb'); | ||
var normalizeId = function() { | ||
var createObjectId = function() { | ||
if (!mongo.BSONNative || !mongo.BSONNative.ObjectID) { | ||
return function(args) { | ||
if (args[0] && typeof args[0] === 'object' && typeof args[0]._id === 'string') { | ||
args[0]._id = mongo.BSONPure.ObjectID.createFromHexString(args[0]._id); | ||
} | ||
return args; | ||
return function(id) { | ||
return mongo.BSONPure.ObjectID.createFromHexString(id); | ||
}; | ||
} | ||
return function(args) { | ||
if (args[0] && typeof args[0] === 'object' && typeof args[0]._id === 'string') { | ||
args[0]._id = new mongo.BSONNative.ObjectID(args[0]._id); | ||
} | ||
return args; | ||
return function(id) { | ||
return new mongo.BSONNative.ObjectID(id); | ||
}; | ||
@@ -91,3 +85,3 @@ }(); | ||
Collection.prototype.find = function() { | ||
var args = normalizeId(Array.prototype.slice.call(arguments)); | ||
var args = Array.prototype.slice.call(arguments); | ||
var oncursor = common.future(); | ||
@@ -139,3 +133,2 @@ var oncollection = this._oncollection; | ||
Collection.prototype._exec = function(name, args) { | ||
var args = normalizeId(args); | ||
var callback = typeof args[args.length-1] === 'function' ? args[args.length-1] : noop; | ||
@@ -156,2 +149,4 @@ | ||
exports.ObjectId = createObjectId; | ||
exports.connect = function(url, collections) { | ||
@@ -196,2 +191,3 @@ url = parse(url); | ||
that.ObjectId = createObjectId; | ||
that.collection = function(name) { | ||
@@ -198,0 +194,0 @@ var oncollection = common.future(); |
@@ -5,3 +5,3 @@ { | ||
"keywords": ["mongo", "db", "mongodb"], | ||
"version":"0.2.4", | ||
"version":"0.2.5", | ||
"homepage" : "https://github.com/gett/mongojs", | ||
@@ -8,0 +8,0 @@ "author": "Ge.tt <hello@ge.tt>", |
@@ -5,3 +5,3 @@ # mongojs | ||
npm install mongojs --mongodb:native | ||
npm install mongojs | ||
@@ -46,2 +46,2 @@ mongojs is very simple to use: | ||
For more detailed information about the different usages of update and quering see [the mongo docs](http://www.mongodb.org/display/DOCS/Manual) | ||
For more detailed information about the different usages of update and quering see [the mongo docs](http://www.mongodb.org/display/DOCS/Manual) |
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
7985
46
7899
202