INNER CODE UNIT · JavaScript

Cursor

mongoist/mongoist · lib/cursor.js:3

class Cursor extends Readable {
  constructor(cursorFactory) {
    super({objectMode: true, highWaterMark: 0});

    this.cursorFactory = cursorFactory;

    // Currently mongodb cursor options itcount, readPref, showDiskLoc are not implemented - and some other
    // See https://docs.mongodb.com/manual/reference/method/js-cursor/
    const operations = ['batchSize', 'hint', 'limit', 'maxTimeMS', 'max', 'min', 'skip', 'snapshot', 'sort', 'collation'];

    this._options = {};
    this._flags = {};

    operations.forEach((operation) => {
      Cursor.prototype[operation] = (data) => {
        this._options[operation] = data;
        return this;
      }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…