If I have the following index:
q.CreateIndex({
name: 'blockListByBlockerId',
source: q.Collection('blockedUser'),
terms: [{ field: ['data', 'blockerId'] }],
values: [
{ field: ['ref'] },
{ field: ['data', 'userId'] }
/**
* how do I add the user's firstname, middlename, and surname here
* so that the result will be sorted by those data without
* adding them to the collection
*/
]
});
which can have the following data:
{
blockerId: '1',
userId: '2'
}
What I want to do is something like this:
q.Map(
q.Paginate(q.Match(q.Index('blockListByBlockerId'), '1')),
q.Lambda(
['ref', 'userId'],
q.Get(q.Ref(q.Collection('users'), q.Var('userId')))
)
);
The result has to be sorted by user.firstName
, user.middleName
(which can be null), user.surname
, so far I cannot find a way to do this without adding these values manually to the pivot collection.