什么是 MarkLogic 中的集合

What are Collections in MarkLogic

“集合不要求成员文档符合任何 URI 模式”。我在 MarkLogic 文档上看到的声明。这到底是什么意思?

这意味着设置 collections 与您构建文档 URI(文档标识符)的方式无关。

您的 URI 中可能恰好有目录,并且可以使用目录来查询和组织内容,但是 collections 是完全独立的。设置(和删除)collections 不依赖于 URI 结构,也不修改它。

您可以设置任意多个 collections。

Collections Versus Directories

Collections are used to organize documents in a database. You can also use directories to organize documents in a database. The key differences in using collections to organize documents versus using directories are:

  • Collections do not require member documents to conform to any URI patterns. They are not hierarchical; directories are. Any document can belong to any collection, and any document can also belong to multiple collections.
  • You can delete all documents in a collection with the xdmp:collection-delete function. Similarly, you can delete all documents in a directory (as well as all recursive subdirectories and any documents in those directories) with the xdmp:directory-delete function.
  • You cannot set properties on a collection; you can on a directory.