我有一个带有四个文档的集合“乐队”的样本数据库“摇滚乐队”。这是一个有效的简单存根(咖啡):
mongo = require('mongoskin')
db = mongo.db('localhost:27017/rockband')
db.collection("bands").find().toArray (err, result) ->
throw err if err
console.log result
这将返回具有良好数据的 json。
但是,以下 mocha 测试通过而没有返回数据或任何投诉:
should = require("should")
mongo = require('mongoskin')
describe "simple test", ->
err = db = null
before (done) ->
db = mongo.db('localhost:27017/rockband')
done()
it "should pass", ->
db.collection("bands").find().toArray (err, result) ->
throw err if err
console.log result
should.not.exist err
有什么建议么?