The solution appears to simply do "let $x := collection()//whatever".
..true, I forgot that; collection() can be used as well to access the database that's currently opened in the GUI/on command line (..or in the "current database context", if we talk about the client APIs).