繁体   English   中英

如何从 mongoose 上另一个数组中的数组中删除一个项目

[英]How can I remove an item from an array inside another array on mongoose

我需要从另一个数组中的数组中删除 object

async function removeEp(id, sectionindex, productindex) {
    let t = await Stores.findById(id);
    t.sections[sectionindex].eps.splice(productindex,1);
    await t.save();
    return t;
}

我试过这段代码,但它并没有改变数据库

我需要从另一个数组中的数组中删除 object

async function removeEp(id, sectionindex, productindex) {
    let t = await Stores.findById(id);
    t.sections[sectionindex].eps.splice(productindex,1);
    await t.save();
    return t;
}

我试过这段代码,但它并没有改变数据库

我需要从另一个数组中的数组中删除 object

async function removeEp(id, sectionindex, productindex) {
    let t = await Stores.findById(id);
    t.sections[sectionindex].eps.splice(productindex,1);
    await t.save();
    return t;
}

我试过这段代码,但它并没有改变数据库

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM