You can't do anything like that with fn:collection.  But if you
have the collections lexicon enabled for the database, you can use
cts:collections to get a list of all collection names and filter it
for the ones that match your pattern.  You can then use those collection
names to count how many documents are in each:

for $collection-name in cts:collections()
where fn:contains ($collection-name, "/Dept/Eng/")
return xdmp:estimate (fn:collection ($collection-name))

---
Ron Hitchens {[email protected]}  +44 7879 358212


On Aug 27, 2013, at 7:08 AM, sini narayanan <[email protected]> wrote:

> Hi All,
> 
> How do I apply regular expression when using fn:collection()?
> Image that I have the collections /Dept/Eng/2011, /Dept/Eng/2012, 
> /Dept/Eng/2013 in my DB.
> I need to get the count of all the documents in the collection starting with 
> /Dept/Eng/*.
> Is it possible using fn:collection?
> 
> Thanks,
> Sini
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to