I have an app deployed on heroku, which keeps crashing because of this error:
events.js:291
2020-12-09T16:08:01.009305+00:00 app[worker.1]: throw er; // Unhandled 'error' event
2020-12-09T16:08:01.009305+00:00 app[worker.1]: ^
2020-12-09T16:08:01.009306+00:00 app[worker.1]:
2020-12-09T16:08:01.009306+00:00 app[worker.1]: MongoError: Unrecognized expression '$or:'
And here’s the implementation of my change stream:
const profPipeLine = [
{
'$match': {
'$expr': {
'$or:': [
{'$eq': ['operationType', 'insert']},
{'$eq': ['operationType', 'update']},
{'$eq': ['operationType', 'delete']}
]
}
}
}
const options = { 'fullDocument': 'updateLookup' };
const profileStream = MatchProfile.watch(profPipeLine, options);
profileStream.on('change', next => {
...
})
Idk why I keep getting that error about $or, because it works without errors locally, and its not the first time i’ve used it. I’m also using nodejs event emmitters in my project, if that may have anything to do with it since I’m sure change streams use the same event emmitter library from nodejs.