Yes, it did help. Thanks a ton : )

On Tue, Feb 13, 2024, 00:08 Christian Grün <christian.gruen@gmail.com> wrote:
Hi Deepak,

For deletions, you can write:

let $db := 'db'
for $path in db:list($db, '2023')[matches(., '/\d\d')]
return db:delete($db, $path)

When accessing documents, it’s faster to iterate over the resources:

for $doc in db:get('db', '2023')
where matches(db:path($doc), '/\d\d')
return ...

Hope this helps,
Christian 



Deepak Dinakara <deepukalmane@gmail.com> schrieb am Mo., 12. Feb. 2024, 18:04:
Hi,

I wanted to know if it's possible to give a regex while deleting a resource.
I have documents stored in a hierarchy of collections like {year}{month}/doc.xml.
Eg: 202301/abc.xml, 202302/def.xml.
If I want to delete a resource "abc.xml", Is it possible to issue commands like "db:delete("db-name", '/*/abc.xml')" ? Right now, I can do a XQuery with db:list and endsWith and get the complete path of "abc.xml". But regex would have been very handy.

Similarly I also want to execute queries against a list of collections using regex.
Something like "for $document in collection('db-name/20230*')" (First 9 months of 2023)
Right now, I am doing something like 
"for $i in ('01', '02', '03', '04', ... '09')
for $document in collection('test-collection/2023' || $i)"
But if there are better ways, kindly let me know.

Thank you,
Deepak