Mongodb extract subarray

for example, multiple documents with the following format (only one is written below):

[
    // key
{
"subkey1": ...,
"subkey2": ...,
"subkey3": ...
},
{
"subkey1": ...,
"subkey2": ...,
"subkey3": ...
},
...
]

if there is an example of node.js "s mongodb library code, it would be even better ^ _ ^

May.05,2022
Using find ({query criteria}, {key:1}, function () {}) in

mongoose can only return key, but a single document is still in the form of an object, that is, {"key": [.]}.


the size of a single document cannot exceed 16MB, so it is obviously unrealistic and not recommended to put all of them in one document. If you want to follow certain conditions, you need to do $group , then you have to decide what conditions to follow $group

.
Menu