Database one way replication

I have a mongo database which I perform extensive aggregations that consumes almost all CPU while aggregation runs. So I was thinking that I could replicate the database and then run aggregations on secondary database. The only problem is that I have to save the results of the aggregations in a secondary collection that does not exists on the primary. Will this cause a problem to the replication? If yes, what other options do I have?

Thank you

Hi, you can only perform read, instead of write on a Secondary node. A VIEW could be one of the alternatives of running your aggregations on a secondary database. But you may need to create the VIEW on the Primary node first, and later read that VIEW from the Secondary node. Of course, then the CPU usage will be very high on the Secondary node.

1 Like