About Collections and Databases
The XQuery documentation does not speak about databases, but collections - thus there is the name collection to conform to the specs. Yet the specification does not define what a collection is, this is implementation dependent. While other systems like Marklogic allow multiple collections in a database, BaseX regards one collection as a single database.
From the BaseX Documentation Wiki:
In BaseX, a database is a pretty light-weight concept and can be compared to a collection. It contains an arbitrary number of resources, addressed by their unique database path.
It is easy and a cheap operation to join over documents from multiple collections/databases, so split up as seams reasonable to you. Actually using multiple databases instead of one can have a positive effect on concurrency.
Managing Databases in BaseX
Databases are managed using BaseX Commands.
Most of interest will be
CREATE DB [name] ([input])
: Create a new database with a given name and input document or XML fragmentOPEN [name]
: Open a database as default collectionDROP DB [name]
: Deletes a database
Managing Databases Using XQuery
For some operations there are also BaseX-specific XQuery-functions in the Database Module, but using them is somewhat restricted by XQuery Update's Pending Update List.
Disclaimer: I'm somewhat involved within the BaseX team.