mongodb-promise
Advanced tools
Comparing version
@@ -76,3 +76,3 @@ var Q = require('q'); | ||
} else { | ||
deferred.resolve(result); | ||
deferred.resolve(new Collection(result)); | ||
} | ||
@@ -79,0 +79,0 @@ }); |
{ | ||
"name": "mongodb-promise", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "A mongodb-native promise library", | ||
@@ -5,0 +5,0 @@ "main": "./lib", |
@@ -12,5 +12,5 @@ mongodb-promise | ||
```js | ||
// Obtaining a connection | ||
var mp = require('mongodb-promise'); | ||
// Obtaining a connection | ||
mp.MongoClient.connect("mongodb://127.0.0.1:27017/test").then(function(db){ | ||
@@ -49,13 +49,10 @@ db.close().then(console.log('success')); | ||
.then(function(db){ | ||
return db.collection('test') | ||
.then(function(col) { | ||
return col.find({a : 1}) | ||
.then(function(cursor){ | ||
return cursor.toArray(); | ||
}) | ||
.then(function(items) { | ||
console.log(items); | ||
db.close().then(console.log('success')); | ||
}) | ||
}) | ||
return db.collection('test') | ||
.then(function(col) { | ||
return col.find({a : 1}).toArray() | ||
.then(function(items) { | ||
console.log(items); | ||
db.close().then(console.log('success')); | ||
}) | ||
}) | ||
}) | ||
@@ -62,0 +59,0 @@ .fail(function(err) {console.log(err)}); |
25078
-0.23%81
-3.57%