Does MongoDB MapReduce lock the database

后端 未结 3 799
情书的邮戳
情书的邮戳 2021-02-14 09:50

Does a MongoDB MapReduce job lock the database? I am developing a multi-user MongoDB web application and am worried about multi-user conflicts and performance. Does anyone hav

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-14 10:29

    No, mapreduce does not lock the database. See the note here, just after "Using db.eval()" (it explains why mapreduce may be more appropriate to use than eval, because mapreduce does not block).

    If you are going to run a lot of mapreduce jobs you should use sharding, because that way the job can run in parallel on all the shards. Unfortunately mapreduce jobs can't run on secondaries in a replica set, since the results must be written and replicas are read-only.

提交回复
热议问题