我想在无删除现有产品的情况下将新产品添加到Allproducts阵列中。
这是数据库。
和代码。该解决方案始终覆盖现有产品。
I would like to add a new product to the allProducts array without deleting the existing product.
Here is the database.
And the code. This solution always overwrite the existing product.
如果要将项目添加到现有数组中,则可以:
您可能想在这里做后者。
If you want to add an item to an existing array, you can:
array-union
You'll probably want to do the latter here.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(1)
如果要将项目添加到现有数组中,则可以:
您可能想在这里做后者。
If you want to add an item to an existing array, you can:
array-union
operator that is described in the documentation on updating an item in an array.You'll probably want to do the latter here.