|Creates a new database with name {{Code|$db}} and adds initial documents specified via {{Code|$inputs}} to the specified {{Code|$paths}}.<br/>{{Code|$inputs}} may be strings or nodes different than attributes. If the {{Code|$input}} source is not a file or a folder, the {{Code|$paths}} argument is mandatory.<br/>Please note that {{Code|db:create}} will be placed last on the [[XQuery Update#Pending Update List|Pending Update List]]. As a consequence, a newly created database cannot be addressed in the same query.<br/>
The {{Code|$options}} argument can be used to change the indexing behavior. Allowed options are [[Options#TEXTINDEX|TEXTINDEX]], [[Options#ATTRINDEX|ATTRINDEX]], [[Options#FTINDEX|FTINDEX]], [[Options#UPDINDEX|UPDINDEX]], [[Options#MAXCATS|MAXCATS]], and [[Options#MAXLEN|MAXLEN]]. Options can either be specified<br />
* as children of an {{Code|<options/>}} element, e.g.:
<pre class="brush:xml">
<options>
* {{Code|db:create("DB", <a/>, "doc.xml")}} creates the database {{Code|DB}} and adds the document with content {{Code|<a/>}} under the name {{Code|doc.xml}}.
* {{Code|db:create("DB", "/home/dir/", "docs/dir")}} creates the database {{Code|DB}} and adds the documents in {{Code|/home/dir}} to the database under the path {{Code|docs/dir}}.
* {{Code|db:create("DB", file:list('.'), map { 'ftindex' := true() })}} adds all files of the current working directory to a new databaseand creates a full-text index.
|}