Advertisement
Guest User

Untitled

a guest
Jul 21st, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const mgo = require('mongodb');
  2. const assert = require('assert');
  3.  
  4. const url = 'mongodb://localhost:27017';
  5. const dbName = 'contested';
  6. const client = mgo.MongoClient;
  7.  
  8. client.connect(url, function (err, ms) {
  9.     assert.equal(null, err);
  10.     console.log('connected\n');
  11.  
  12.     const db = ms.db(dbName);
  13.     const raids = db.collection('raids');
  14.     const cs = raids.watch();
  15.     pull(cs);
  16. });
  17.  
  18. async function pull(cs) {
  19.     const next  = await cs.next
  20.     console.log(next);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement