MongoDB remove mapreduce collection

前端 未结 2 1006
-上瘾入骨i
-上瘾入骨i 2021-02-15 06:44

Due to error in client code, mongodb have created many \"mr.mapreduce....\" collections, how to remove them all (by mask maybe).

2条回答
  •  爱一瞬间的悲伤
    2021-02-15 07:32

    Temporary map-reduce table should be cleaned up when the connection which created them is closed:

    map/reduce is invoked via a database command. The database creates a temporary collection to hold output of the operation. The collection is cleaned up when the client connection closes, or when explicitly dropped. Alternatively, one can specify a permanent output collection name. map and reduce functions are written in JavaScript and execute on the server.

    -- MongoDB docs

    If not, you could delete them using them same method you would delete any other collection. It might get a bit repetitive though.

提交回复
热议问题