High CPU Usage 90% with Change stream and 20% without Change stream

We are running Change Stream for some time but have started seeing behaviour where the CPU Spikes for long duration of time.
Setup: We are using MongoDB 4.4 version Replica Set, primary and two replicas
12 cpu , 252GB RAM and 2TB data disk each.
and using Python to open a changestream.

pipeline = [{"$addFields": {
        "tmpfields": {
            "$objectToArray": "$updateDescription.updatedFields"}
        {"$match": {"tmpfields.k": {
            "$nin": ["updated_at"] if cfg.CONF.is_resource == "True" else [
cursor = client[collection].watch(full_document='updateLookup',
                      pipeline=audit_filter if cfg.CONF.is_audit == "True" else pipeline, start_after=resume_token_new)

App Dynamics

Kindly Assist.

1 Like

I’m experiencing the same thing on our production deployment. It seems to use an entire core spinning, while also generating a ton of “slow query” log messages.