clean up more

This commit is contained in:
np.w
2021-02-19 20:00:34 -06:00
parent 2f0ac5b042
commit 5bab7525b8
+2 -1
View File
@@ -120,8 +120,9 @@ app.post('/box/item/:itemId/:boxIdTarget', async (request, response) => {
//the way I am doing this cannot be the best way...fix me later
try {
//get item in source box
//find source box
const box = await Box.find({ "item._id": itemID });
//get item in source box
const item = await Box.find({ "item._id": itemID }, { item: { $elemMatch: { _id: itemID } } });
//remove item from source box
await Box.updateOne({ _id: box[0]._id }, { $pull: { item: { _id: itemID } } });