I am looking at the documentation for WITHDB and I want to ask for further explanation 'If db:open is consistently used to access documents', does it means as opposed to having a DEFAULTDB or does it mean that we use db:open but not local queries on the document obtained (example below), or since there is a notion of lock, do you mean db:open as opposed to db:add or db:replace? In short, I lack context to interpret the explanation.

let $current-doc := db:open($lang)/*[@id=x]
(: Query document further without db:opened :)
let $avaliable-sections := $current-doc/descendant::*[name()=''section][@status !='archived']

From the documentation:

WITHDB

Introduced with Version 9.3.

SignatureWITHDB
Defaulttrue
SummaryBy default, URIs specified in the fn:doc and fn:collection functions will also be resolved against existing databases. If db:open is consistently used to access database documents, it is recommendable to disable this option:
  • Access to local and external resources will be faster, as the database lookup will be skipped.
  • No locks will be created by the two functions (see limitations of database locking for more details).


--
France Baril
Architecte documentaire / Documentation architect
france.baril@architextus.com