Mongodb changestream getmore runs as collscans

How do we handle mongodb change stream queries with getmore queries that are running as collscans on the server. Is there a way to avoid collscans ? Or is there a way to reduce the impact of changestreams on performance.

Changestreams do not do a traditional COLLSCAN because they are not querying any of your collections, they are watching/querying the oplog, a special system collection also used for replication.

Can you explain what’s behind your question since changestream getmore usually just gets data from the tail end of the oplog. What’s the reason that you think it’s impacting your performance?


Hello, I have a similar issue and hope this will not be considered hijacking.
I have a number of running change-streams that all appear in currentOp’s output with
“planSummary”: “COLLSCAN”
All report execution time of around 900ms.
I don’t know that the change-streams impacting the DB performance, but the currentOp’s output is worrying.
Please advise

Not sure why it’s worrying - see my response above.

Thanks @Asya_Kamsky for the prompt response.
What was worrying to me was the 900ms execution time; we monitor execution times to make sure all of our queries are performant.
Judging by your answer, I now assume a change-stream’s execution time is considered a non-busy-wait on the DB.
If my assumption is wrong, please let me know

Your assumption is correct. We’ve actually been considering how we can more appropriately mark change streams and other such queries so as not to “trip” any such monitoring…