* {{Code|doc('factbook')}}, read-locking of "factbook"
* {{Code|collection('db/path/to/docs')}}, read-locking of "db"
* {{Code|fn:sum(1 to 100)}}, locking nothing at all
* {{Code|delete nodes db:open('test')//*[string-length(local-name(.)) > 5]}}, write-locking of "test"
* {{Code|fn:sum(1 to 100)}} (no lock)
A global lock will be assigned if the name of the database is not a static string: