Meteor cannot use $ elementMatch

I use $elementMatchto query in a custom collection:

Template.AccountInfo.helpers({
  counter() {
    return Meteor.users.find({
      accounts: {
        $elementMatch: {
          bal: {
            $exists: false
          }
        }
      }
    }).fetch();
  },
});

This request works fine on the server, but on the client I get only the error below. What could be wrong?

Exception in template helper: Error: Unrecognized operator: $elementMatch ...
+4
source share
1 answer

On the client, Meteor uses MiniMongo , which implements a subset of MongoDB statements.

Are you sure you didn’t mean $elemMatchwhich MiniMongo was implemented in v0.7.2 ? I am wondering how this works on the server.

In any case, since you have only one criterion, you really do not need it as it is.

, $elementMatch.

Notes. , $elemMatch , , , .

:

  • $elemMatch $all
  • , $near ($ nearSphere, $geoIntersects, $geoWithin)
+2

Source: https://habr.com/ru/post/1669445/


All Articles