Oplog integration gives a huge performance boost for Meteor apps, and it’s recommend to use oplog with every production Meteor app. MongoHQ makes it super easy with their affordable MongoDB elastic scaling service.
Meteor supports most of the queries with oplog, but there are some edge cases where observers will fall back into an inefficient poll and diff implementation. It’s very hard to implement oplog support for those queries unless MongoDB supports built-in observing functionality.
Therefore, some of the queries in your app may fail to use oplog even if you’ve integrated oplog support into your app. I will show what those unsupported queries are and how to identify them easily.
Let me show you those edge cases in which oplog support cannot be enabled.
If you add a sort specifier, you can simply get rid of this issue.
Meteor’s oplog integration does not support the $where operator or any geo–location specific operators. Therefore, you will need to find an alternative if you require oplog support for those queries.
Meteor’s oplog integration relies on MiniMongo for projections. MiniMongo does not support all of the projection operators. One such operator is $elemMatch. If you are using such operators in your query, your query won’t receive the oplog support.
Due to a runtime error, it is possible to have the remainder listed as null. MiniMongo requires the $mod array to be filled with two numbers; therefore, oplog support won’t be enabled for the above query.
Because it is using $natural, it won’t be able to get the oplog support.
Now you clearly know why some of your observers cannot use oplog support. But it is really hard to find the reason for such queries in production, especially with invalid selectors.
From the very beginning, Meteor APM shows you whether oplog is enabled or not for your observers via its tracing support. But it doesn’t tell you why. From today onward, you’ll be to see the reason and the potential fix for your query.
Now you know how to optimize your app for Meteor’s oplog integration and find out whether oplog support is enabled for your individual observers. If it is not, Meteor APM will help you to determine the reason and fix it.