Christoph Walcher
9 years ago
1 changed files with 15 additions and 4 deletions
@ -1,16 +1,27 @@ |
|||||
var test = require('./tape') |
var test = require('./tape') |
||||
var mongojs = require('../index') |
var mongojs = require('../index') |
||||
var db = mongojs('test', ['test.dot']) |
var db = mongojs('test', ['test.dot']) |
||||
|
var dbNoCollections = mongojs('test') |
||||
|
|
||||
test('find in dot collection', function (t) { |
test('find in dot collection', function (t) { |
||||
db['test.dot'].drop(function () { |
var collection = db['test.dot'] |
||||
db['test.dot'].insert({ name: 'dot' }, function (err) { |
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) |
t.error(err) |
||||
db['test.dot'].findOne(function (err, doc) { |
collection.findOne(function (err, doc) { |
||||
t.error(err) |
t.error(err) |
||||
t.equal(doc.name, 'dot') |
t.equal(doc.name, 'dot') |
||||
t.end() |
t.end() |
||||
}) |
}) |
||||
}) |
}) |
||||
}) |
}) |
||||
}) |
} |
||||
|
Loading…
Reference in new issue