UNPKG

reactive-superglue

Version:

Stream-based middleware for I/O integration of sources and sinks

45 lines (37 loc) 1.02 kB
var _ = require("../") var mydb = new _.mongodb("mongodb://localhost/weplan_partis") function testReader() { var src = mydb .collection("events") .find({event_type: "call_data_connection_state"}) src.map(JSON.stringify) .map(x => x + "\n") .pipe(process.stdout); setTimeout(function () { src.end() mydb.close() }, 2000) } testReader() function test() { var mydb = new _db("mongodb://localhost/weplan_partis") mydb .collection("events") .find({event_type: "sms"}) .upsert(mydb.collection("kk")) .done(function () { console.log("finished") }) mydb .collection("events") .find({event_type: "call_data_connection_state"}) .map(JSON.stringify) .map(x => x + "\n") .pipe(process.stdout); mydb .collection("events") .find({event_type: "sms"}) .map(JSON.stringify) .map(x => x + "\n") .pipe(process.stdout); }