当前位置: 代码迷 >> 综合 >> Mongoose - 一次删除多条数据deleteMany
  详细解决方案

Mongoose - 一次删除多条数据deleteMany

热度:90   发布时间:2024-01-15 11:30:41.0

输入数据:

let itemCheckLists = [ { _id: 5caacd37cc89133f5886f289,sameStatusUsers: [],initiator: 5c9d8cc3161d6c257c021340,list: 5c9da1418f9db32aec7c03aa,listItem: 5caacbf2cc89133f5886f283,created: 2019-04-08T04:25:27.541Z,updated: 2019-04-08T04:25:27.541Z,__v: 0 } ]
[ { _id: 5cce66faf74c3418f86faef2,sameStatusUsers: [],initiator: 5c9d8cc3161d6c257c021340,list: 5cce6297f74c3418f86faed1,listItem: 5cce6330f74c3418f86faee3,created: 2019-05-05T04:30:50.320Z,updated: 2019-05-05T04:30:50.320Z,__v: 0 } ]
ItemCheckOfArchive.deleteMany({_id: {$in: itemCheckLists}})