user3636924
user3636924

Reputation: 131

What are Collections in MarkLogic

"Collections do not require member document to conform to any URI patterns". The statement I saw on MarkLogic documentation. What actually does that mean?

Upvotes: 1

Views: 67

Answers (1)

Mads Hansen
Mads Hansen

Reputation: 66714

It means that setting collections has nothing to do with how you structure your document URIs (the identifier for the document).

You may happen to have directories in your URI, and can use directories to also query and organize content, but collections are totally separate. Setting (and removing) collections does not depend upon the URI structure and does not modify it.

You can set as many collections as you want.

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.

Upvotes: 5

Related Questions