Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-435

MongoError: No more documents in tailed cursor

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.0.27
    • Component/s: None
    • Environment:
      os: Windows 8, node: 0.12.2

      In 1.x.x I used:
      var collection = db.collection('socket');
      var tailableRetryInterval = 200;
      var errorTimeout = 1000;

      function init(latest) {
      return collection.find({_id: {$gt: latest._id}},

      { tailable: true, numberOfRetries: -1, tailableRetryInterval: tailableRetryInterval }

      );
      }

      collection.isCapped(function(err, capped) {
      if (err) throw err;
      if (!capped) throw new Error('Collection ' + collection.collectionName + ' is not capped');
      var latest = collection.find({}).sort(

      { $natural: -1 }

      ).limit(1);
      latest.nextObject(function(err, item) {
      if (err) throw err;
      if (!item) throw new Error('Collection ' + collection.collectionName + ' is empty');
      (function listen(cursor) {
      console.log('Adapter started tailing collection ' + collection.collectionName);
      (function next(last) {
      cursor.nextObject(function(err, item) {
      if (err || !item)

      { console.error(err || new Error('Adapter failed getting nextObject')); return setTimeout(listen.bind(null, init(last)), errorTimeout); }

      console.log('item:', item);
      next(item);
      });
      })(item);
      })(init(item));
      });
      });
      Everything was fine.

      Now I'm trying:
      function init(latest) {
      return collection.find({_id: {$gt: latest._id}},

      { tailable: true, tailableRetryInterval: tailableRetryInterval, awaitData: true }

      );
      }
      And get MongoError: No more documents in tailed cursor

      Is it ok to skip this error or I'm doing something wrong?

            Assignee:
            christkv Christian Amor Kvalheim
            Reporter:
            dab00 Anatoly Demidovich
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: