Differences in Mongo.Collection.find().fetch() method between 1.6 and 1.7 versions


#1

Hi,

I’ve recently upgraded my Meteor application from 1.6 to 1.7 version and found the following change:

Meteor 1.6

let value = undefined;
MongoCollection.find({ key: value}).fetch();

Returns empty array [].

Meteor 1.7:

let value = undefined;
MongoCollection.find({ key: value}).fetch();

Returns all documents from ‘MongoCollection’.

Did anybody face such an issue? Can you help me to understand whether it’s a bug or a feature?

Thank you in advance.


#2

From the 1.6.1 release notes:

Meteor’s Node Mongo driver is now configured with the ignoreUndefined connection option set to true, to make sure fields with undefined values are not first converted to null, when inserted/updated. Fields with undefined values are now ignored when inserting/updating. Issue #6051 PR #9444


#3

It seems I completely missed that paragraph while reading the release notes.

Thank you!