user3636924
user3636924

Reputation: 131

Can MLCP read input based on a condition

In marklogic, using MLCP can we read /export/import/copy data based on a condition?

Example : read only files with students subject element has only maths

Upvotes: 1

Views: 73

Answers (1)

Mads Hansen
Mads Hansen

Reputation: 66781

Yes, you can apply the -query_filter option to restrict documents to those matching the filter query.

https://docs.marklogic.com/guide/mlcp/export#id_66898

The -query_filter option accepts a serialized XML cts:query or JSON cts.query as its value.

Controlling What is Exported, Copied, or Extracted

By default, mlcp exports all documents or all documents and metadata in the database, depending on whether you are exporting in document or archive format or copying the database. Several command line options are available to enable customization.

  • -query_filter - export/copy only documents matched by the specified cts query. You can use this option alone or in combination with a directory, collection or document selector filter.
  • -directory_filter - export only the documents in the listed database directories. You cannot use this option with -collection_filter or -document-selector.
  • -collection_filter - export only the documents in the listed collections. You cannot use this option with -directory_filter or -document_selector.
  • -document_selector export only documents selected by the specified XPath expression. You cannot use this option with -directory_filter or -collection_filter. Use -path_namespace to define namespace prefixes.

Upvotes: 1

Related Questions