如果有人可以向我解释以下三个查询之间的区别以及为什么只有最后一个查询有效,我将不胜感激.
select out() from #1:0 where @class instanceof 'BaseClass'
select expand(out()) from #1:0 where @class instanceof 'BaseClass'
select from (select expand(out()) from #1:0) where @class instanceof 'BaseClass'
Run Code Online (Sandbox Code Playgroud)
非常感谢你的帮助!
小智 5
因为在前两种情况下,where条件没有得到很好的应用.第一个out()只返回一个记录id的集合,第二个是数组在文档集合中展开和转换,但我认为在扩展之前应用where条件,因此情况1不起作用.
如果您不想使用子查询,您可以随时使用
select expand(out()[ @class = 'BaseClass']) from #1:0
Run Code Online (Sandbox Code Playgroud)