簡體   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