从多个集合中搜索最新文档 [英] search latest document from multiple collection

查看:79
本文介绍了从多个集合中搜索最新文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有2个收藏集/test/123和test/567,我想返回最新的 这两个收藏的文件.

There are 2 collections /test/123 and test/567 I want to return the latest document of both the collections.

let $a := cts:collection-match("/test/*")
 for $t in $ a
 let $latest :=(
 for $doc in fn:collection( $t)
  order by $doc//timestamp descending 
  return $doc)[1]
 return fn:concat($latest//id/text(),",",$latest//timestamp/text())

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆