mongodb 中合并相同的表

const books3 = await Book3.find({}).exec()

    for(const item of books3) {
      const d = JSON.parse(JSON.stringify(item))
      delete d.id
      await new Book(d).save()
    }
   
// 把book3中的表插入到book中
// 把原来的表数据遍历一下,删除ID,然后插入数据
posted @ 2021-10-07 10:25  wmui  阅读(229)  评论(0编辑  收藏  举报