Conversation
mongodb-queue.js
Outdated
| }) | ||
| } | ||
|
|
||
| Queue.prototype._optionsWithNewDocument = function(query) { |
There was a problem hiding this comment.
Maybe renaming the function to getDefaultQueryOptions might improve readability
There was a problem hiding this comment.
It's not quite what this function does: it actually adds the "return a new document" flag (whatever that is) to the passed set of options.
If we had access to the spread operator you could do something like:
var options = {
// other options here
...self._returnNewDocument(),
}...but we can't really do that without a transpiler I think.
There was a problem hiding this comment.
Could just call it _returnOriginal() anyway. Probably just as meaningful with fewer words:
var options = self._returnNewDocument({
// other options
})There was a problem hiding this comment.
So I got a question, sorry for my ignorence, but why don't you just replace the flag and discard the previous/deprecated option?
If the usage is deprecated, just replace it ?
There was a problem hiding this comment.
To avoid making this a breaking change — it would break any clients who are using older versions of mongodb.
The `mongodb` Node.js driver deprecated use of `returnOriginal` in
favour of `returnDocument` in [v3.6][1].
This non-breaking change allows consumers to opt in to using the newer
`returnDocument` by setting an option on construction
```js
var queue = mongoDbQueue(db, 'queue', { returnDocument : true })
```
[1]: mongodb/node-mongodb-native#2808
1a04099 to
44fb12c
Compare
Fixes #38
The
mongodbNode.js driver deprecated use ofreturnOriginalinfavour of
returnDocumentin v3.6.This non-breaking change allows consumers to opt in to using the newer
returnDocumentby setting an option on construction