I am trying to attach doc into all object of array as following and i am using CB4.1
{
"_type": "AsgList",
"assignedUsers": [
{
"reason": "Assigned By Prof. Batra",
"userId": "B1PHCzHn57d79e3f"
},
{
"reason": "Recommened by ES.Ratnakar",
"userId": "S1XeYBh57d8006b"
},
{
"reason": "Compulsory assignment",
"userId": "ByC8ltrh57d80055"
}
],
"id": "TA112",
"title": "New Physics Lab Work"
}
and this is user Doc
{
"_type": "User",
"email": "rk@nauni.edu",
"role": "STUDENT",
"userName": "Raul Poelo"
.
.
.
}
I am using this query for getting this result
select list.__type, list._id,userList from default list left nest default nestedUser on keys list.assignedUsers[*].userId let userList = array {“user”:u,“reason”:first child.reason for child in list.assignedUsers when child.userId = u.id} for u in nestedUser end where list. _type = “AsgList”;
and getting this :
[{“code”:3000,“msg”:“syntax error - at }”},{“original_query”:“select cbq_query_workbench_limit.* from (select list._type, list._id,userList from default list left nest default nestedUser on keys list.assignedUsers[*].userId let userList = array {"user":u,"reason":first child.reason for child in list.assignedUsers when child.userId = u._id} for u in nestedUser end where list._type = "AsgList") cbq_query_workbench_limit limit 1000;”}]
whereas i supposed that i will get something like following
[
{
"_type": "AsgList",
"id": "TA112",
"title": "New Physics Lab Work"
"userList": [
{
"reason": "Recommened by ES.Ratnakar",
"user": {
"_type": "User",
"email": "rk@nauni.edu",
"role": "STUDENT",
"userName": "Raul Poelo"
.
.
.
}
},
{
"reason": "Assigned By Prof. Batra",
"user": "user": {
"_type": "User",
"email": "rk@nauni.edu",
"role": "STUDENT",
"userName": "Raul Poelo"
.
.
.
}
},
.
.
.
]
}
]
If i am giving static value in reason field in array then getting proper result so i thing theres an error with first clause
So can anyone help me with this query
thanks in advance