scripts/change-stream.js
//this function polls a change stream and prints out each change as it comes in
this function polls a change stream and prints out each change as it comes in
this function polls a change stream and prints out each change as it comes in
function pollStream(cursor) {
  while (!cursor.isExhausted()) {
    if (cursor.hasNext()) {
      var change = cursor.next();
      print(JSON.stringify(change));
    }
  }
  pollStream(cursor);
}
function pollStream ( cursor ) { while ( ! cursor . isExhausted ( ) ) { if ( cursor . hasNext ( ) ) { var change = cursor . next ( ) ; print ( JSON . stringify ( change ) ) ; } } pollStream ( cursor ) ; }
this function polls a change stream and prints out each change as it comes in
this function polls a change stream and prints out each change as it comes in