I am new to streams and I am trying to fetch the data from my collection using reactive-superglue/highland.js (https://github.com/santillaner/reactive-superglue).
var sg = require("reactive-superglue")
var query = sg.mongodb("mongodb://localhost:27017/qatrackerdb").collection("test1")
exports.findAll = function (err, res) {
query.find()
.map(JSON.stringify)
.done(function(data) {
console.log(data)
res.end(data)
})
}
my curl request:
curl -i -X GET http://localhost:3000/queries/
I'm not really sure what
reactive-superglue
is doing for you here. It looks like it's just a compilation of highland shortcuts for getting different data sources to respond.You can use highland to do this directly like this:
Edit: The above snippet still uses
reactive-superglue
, but you could just use the node mongo driver: