@mansura-habiba you should use db.replicator()
as per the example shown here:
Note that this call is asynchronous so you will probably want to poll the result if you have any logic which is dependent on the replication completing or erroring.
Sorry for the confusion, we have two similarly named methods for replicating:
replication
which uses the older_replicate
endpointreplicator
which uses the replicator database