diff --git a/lib/channel.js b/lib/channel.js index 09b53d6..ad5d11b 100644 --- a/lib/channel.js +++ b/lib/channel.js @@ -29,7 +29,6 @@ class Channel extends EventEmitter { max: options.max } - this.options = options this.connection = connection this.closed = false this.listening = null @@ -171,11 +170,9 @@ class Channel extends EventEmitter { tailable: true, awaitData: true, timeout: false, - sortValue: { $natural: -1 }, - numberOfRetries: Number.MAX_VALUE, - tailableRetryInterval: self.options.retryInterval + maxAwaitTimeMS: self.options.retryInterval } - ) + ).hint({ $natural: 1 }) const next = self.handle(function (doc) { // There is no document only if the cursor is closed by accident. // F.e. if collection was dropped or connection died. @@ -227,7 +224,7 @@ class Channel extends EventEmitter { function onCollection (collection) { const cursor = collection .find(latest ? { _id: latest._id } : {}, { timeout: false }) - .sort({ $natural: -1 }) + .hint({ $natural: -1 }) .limit(1) cursor .next()