Comparing version 2.2.2 to 2.3.0
@@ -144,2 +144,12 @@ var mongodb = require('mongodb') | ||
Collection.prototype.rename = function (name, opts, cb) { | ||
if (typeof opts === 'undefined') return this.rename(name, {}, noop) | ||
if (typeof cb === 'undefined') return this.rename(name, noop) | ||
this._getCollection(function (err, collection) { | ||
if (err) return cb(err) | ||
collection.rename(name, opts, cb) | ||
}) | ||
} | ||
Collection.prototype.drop = function (cb) { | ||
@@ -146,0 +156,0 @@ this.runCommand('drop', cb) |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "2.2.2", | ||
"version": "2.3.0", | ||
"repository": "git://github.com/mafintosh/mongojs.git", | ||
@@ -54,5 +54,5 @@ "author": "Mathias Buus Madsen <mathiasbuus@gmail.com>", | ||
"coordinates": [ | ||
48.22875519999999, | ||
16.3954423 | ||
48.2288574, | ||
16.3957216 | ||
] | ||
} |
var test = require('./tape') | ||
var mongojs = require('../index') | ||
var db = mongojs('test', ['test.dot']) | ||
var dbNoCollections = mongojs('test') | ||
test('find in dot collection', function (t) { | ||
db['test.dot'].drop(function () { | ||
db['test.dot'].insert({ name: 'dot' }, function (err) { | ||
var collection = db['test.dot'] | ||
testDropInsertAndFind(t, collection) | ||
}) | ||
test('find in dot collection', function (t) { | ||
var collection = dbNoCollections.collection('test.dot') | ||
testDropInsertAndFind(t, collection) | ||
}) | ||
function testDropInsertAndFind (t, collection) { | ||
collection.drop(function () { | ||
collection.insert({ name: 'dot' }, function (err) { | ||
t.error(err) | ||
db['test.dot'].findOne(function (err, doc) { | ||
collection.findOne(function (err, doc) { | ||
t.error(err) | ||
@@ -16,2 +27,2 @@ t.equal(doc.name, 'dot') | ||
}) | ||
}) | ||
} |
Sorry, the diff of this file is not supported yet
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
2118
207494