Skip to content

Error "When you subscribe directly, you can't have other specified fields rather than $in" is unclear #416

@Float07

Description

@Float07

I have the following observer being created in my server, which I created to test something with Redis Oplog:

Collection.find({
  _id: { $nin: ignoredIds },
  'tests.firstTest': 1,
}, {
  fields: {
    _id: 1,
  },
}).observe({
  added: (doc) => {
    const docId = doc._id;
    doSomething(docId);
  },
});

However, it seems like this throws the following error:

uncaughtException Error: [When you subscribe directly, you can't have other specified fields rather than $in]

This error isn't very clear about what I'm doing wrong, and how I could solve it. I think the main issue is that the expression "subscribe directly" isn't immediately obvious.

We are currently avoiding to use $in and $nin expressions when creating observers outside of a publication, as we didn't get this error inside publications for some reason. But we're actually not sure what was going wrong, so we're not sure what specifically to avoid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions