I know how to use the new "!" in simple for loops like so:
$t2/Course ! map {./SubjectId : .}
But how do you use this new "!" in more complex for statements that contain "lets" and "groups" like this:
for $e2 in $t2/Course
let $foreignId := $e2/SubjectId
group by $foreignId
return map {$foreignId : $e2}
Thanks!
Your first example is wrong. The bang operator is a simple infix operator so
for $t2/Course ! map {./SubjectId : .}
should be
$t2/Course ! map {./SubjectId : .}
(And of course the "./" is redundant, but some people like to use it anyway.)
"How do you use this new "!" in more complex for statements". Perhaps you don't. What do you want to achieve? The bang operator can replace simple "for" expressions, and it can sometimes replace "/", but it's not designed as a replacement for everything.