I have a collection of documents with a large array.
How correctly, for example, to delete several elements of an array, change the order (sort) or add a new element to the end? Need to reload an array?
I have a collection of documents with a large array.
How correctly, for example, to delete several elements of an array, change the order (sort) or add a new element to the end? Need to reload an array?
Use operations to work with arrays. With the help of them you can modify the array in different ways.
https://docs.mongodb.com/manual/reference/operator/update-array/
If the array is so large that the search operations of the element take a long time, then you can make an index on the array.
Source: https://ru.stackoverflow.com/questions/719038/
All Articles