Created
November 23, 2015 18:14
-
-
Save eedrummer/ee2db2cc1d996f69a7fa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
let async = require("async"); | |
let MongoClient = require('mongodb').MongoClient; | |
MongoClient.connect('mongodb://127.0.0.1:27017/fhir', function(err, db) { | |
let patientCollection = db.collection('patients'); | |
let cursor = patientCollection.find() | |
async.waterfall([ | |
callback => { | |
cursor.toArray(function(err, items) { | |
callback(err, items); | |
}); | |
}, | |
(items, callback) => { | |
console.log("count: " + items.length); | |
callback(null); | |
} | |
], () => db.close()); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment