Hello
I’m trying to build a query that would return an object. The keys in this object would be each user’s primary key and the values would be the user’s data.
I want it to look like this:
{
"user::1": {
fullName: {
first: "User",
last: "one"
},
profilePicture: "www.google.com"
},
"user::2": {
fullName: {
first: "User",
last: "Two"
},
profilePicture: "www.google.com"
},
"user::3": {
fullName: {
first: "User",
last: "Three"
},
profilePicture: "www.google.com"
}
}
Here is the query that I was able to come up with:
SELECT RAW OBJECT META(u).id: {'fullName': u.fullName, 'profilePicture': u.image} FOR `user` IN [ `u` ] END
But for some reason each object gets wrapped inside another object like this:
[
{
"user::1": {
fullName: {
first: "User",
last: "One"
},
profilePicture: "www.google.com"
},
},
{
"user::2": {
fullName: {
first: "User",
last: "Two"
},
profilePicture: "www.google.com"
},
},
{
"user::3": {
fullName: {
first: "User",
last: "Three"
},
profilePicture: "www.google.com"
},
},
]
I want to get rid of the outer object wrapping each returned document. I tried many different options, such as user RAW
above but none of them seem to work.