The requirement is to get the Full Doc and the query should take an additional limit and offset like offset 0 and limit 2 should return the below data (partial for addresses variable)
and then for offset 2 and limit 2 must return the rest of the data like
“person”:{
“name”:“User_1”,
“addresses”: [
{“city” : “c”},
{“city” : “d”}
],
“age” : 26
}
You would simply list your fields and use array sub-scripting (slicing) to return portions of the array, advancing as you would with offsets and limits:
If you go beyond the bounds of the array, the result of the sub-scripting is MISSING so you may want an initial query using ARRAY_LENGTH() to determine the upper limit.
There are many other fields in the document (this is sample, I have 100 other fields in actual one), and this way I will have to list all, tomorrow if new field is added , will have to update the query.
Any Syntax which can pull other fields and addresses part is only what is required.
(I would add that if your application isn’t using all the fields then this is less efficient in terms of transfer than listing the desired fields and updating the query when the application should be aware of a change in the fields list.)