如何获取刚插入数据库的记录的_id值?

发布于 5 年前作者 junqian9412 次浏览最后编辑 5 年前来自 ask

如题

3 回复
rxie
rxie1 楼4 年前

collection.add后会返回_id

changxiulan
changxiulan2 楼4 年前
db.collection('数据库表单名').where({
//Customer数据库表单名称
//where根据条件筛选id的值,要查哪个就写死哪个
_id'对应id名称'
      }).get().then(res => {
        console.log(res)
        this.setData({
          imager: res.data[0].imager
        })
      })
yang69
yang693 楼3 个月前

查一下。。。