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
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.
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.