poseidon-mongo
Version:
A future wrapper around the Node Native MongoDB driver using Poseidon.
25 lines (22 loc) • 583 B
text/coffeescript
Mongo = require '../index'
Driver = new Mongo.Driver()
{Database} = Mongo
assert = require 'assert'
Driver.configure('test', { hosts: ['127.0.0.1:27017'], database: 'test', options: { w: 1 } })
client = new Database(Driver, 'test')
client.collection('test_insert')
.then (collection) ->
collection.insert({a:2})
.then (docs) ->
collection.count()
.then (count) ->
assert(count, 1);
collection.find()
.then (cursor) ->
cursor.toArray();
.then (results) ->
assert(results.length, 1);
assert(results[0].a, 2);
.finally () ->
client.close()
.done()