Merge pull request #11894 from meteor/fix/revert-id-exclusion-exception

Remove throw on _id exclusion inside mongo collection finds
This commit is contained in:
Renan Castro
2022-02-08 12:55:03 -03:00
committed by GitHub
4 changed files with 9 additions and 11 deletions

View File

@@ -10,6 +10,10 @@
#### Independent Releases
* `mongo@1.14.3` at 2022-02-08
- Remove throw on _id exclusion inside mongo collection finds. [PR](https://github.com/meteor/meteor/pull/11894).
* `mongo@1.14.2` at 2022-02-06
- Fix flatten object issue when internal object value is an array on oplog converter. [PR](https://github.com/meteor/meteor/pull/11888).
* `mongo@1.14.1` at 2022-02-04
- Fix flatten object issue when the object is empty on oplog converter. [PR](https://github.com/meteor/meteor/pull/11885), [Issue](https://github.com/meteor/meteor/issues/11884).

View File

@@ -343,13 +343,6 @@ Object.assign(Mongo.Collection.prototype, {
)
);
const { projection } = newOptions;
// this error: "Cannot do exclusion on field _id in inclusion projection"
// happens on MongoDB CLI but doesn't happen in the Node.js Driver for MongoDB 5.0+
if (projection && projection._id != null && !projection._id) {
throw new Error(`Cannot do exclusion on field _id in inclusion projection, collectionName=${self._name}`);
}
return {
transform: self._transform,

View File

@@ -48,9 +48,10 @@ _.each ([{added: 'added', forceOrdered: true},
handle.stop();
test.throws(function () {
c.find({}, {fields: {noodles: 1, _id: false}})
}, undefined, 'bad cursor excluding _id from projection');
const badCursor = c.find({}, {fields: {noodles: 1, _id: false}});
test.throws(function () {
badCursor.observeChanges(logger);
});
onComplete();
});

View File

@@ -9,7 +9,7 @@
Package.describe({
summary: "Adaptor for using MongoDB and Minimongo over DDP",
version: '1.14.2'
version: '1.14.3'
});
Npm.depends({