Details
Description
For example, with the following data set:
user::a
{ "name": "Amy", "friends": ["user::b", "user::c", "user::d"] }user::b
{ "name": "Bruno" }user::c
{ "name": "Cameron" }user::d
{ "name": "Declan" }
N1QL query:
|
SELECT u, f[*].name AS friendNames
|
FROM user_profiles u
|
USE KEYS "user::a"
|
NEST user_profiles AS f
|
ON KEYS u.friends;
|
Executing above query returns the following result.
However, the friendNames is not ordered as these keys are ordered in the original u.friends array.
It seems that the result ordering is at random, every time returns different result.
N1QL query result:
[ {
|
"friendNames": [
|
"Declan",
|
"Bruno",
|
"Cameron"
|
],
|
"u": {
|
"friends": [
|
"b", "c", "d"
|
],
|
"name": "Amy"
|
}
|
} ]
|
I've tested this with 4.0 GA and 4.1 DP, and got the same result.
For some use cases, preserving the original order is critical.
The nested object should be returned in the order of the keys array.
An array is an ordered sequence of zero or more values.
http://www.rfc-editor.org/rfc/rfc7159.txt
Attachments
Issue Links
- blocks
-
MB-20290 4.6.0 Point Release
- Closed