Hello! I have a collection with records like these
{
key: [{key1: 2}, {key1: 0}, {key1: 3}]
}
And I need to push a new dictionary in that list. (Push something like {key1: x}) x must be an smallest element from range 0, 1, 2 … infinity which is not in values of other dictionaries. (I hope that it is understandable)
For given example an solution would push {key1: 1} to list.
How to do it? Thanks.
I believe you wanted to printout the smallest value in the key1 of key array. I have inserted sample 3 docs to the test collection and wrote a aggrgation query to get the smallest of key value in that array: