|Returns the document at the location {{Code|path/to/docs}} in the database {{Code|db}}.<br/>An error is raised if the specified yields zero or more than one document.
|}
You can access multiple databases in a single query:
<pre class="brush:xquery">
for $i in 1 to 100
return db:open('books' || $i)//book/title
</pre>
If the [[Options#DEFAULTDB|DEFAULTDB]] option is turned on, the path argument of the {{Code|fn:doc}} or {{Code|fn:collection}} function will first be resolved against the globally opened database.