marklogicmlcp

MLCP export/import collection


I exported a collection to file system with the following statement:

mlcp.sh export -mode local -host some.url -port 8000 \
 -username user -password password -output_file_path abcd -database some-database \
 -collection_filter abcd -copy_collections true -ssl true \
 -copy_metadata true -copy_properties true 

but when I imported the collection to another database, the imported documents show no collection and the URI got changed to file path. The following is the statement that I used for import:

mlcp.sh import -mode local -host some-url -port 8000 \
 -username user -password password -input_file_path ./abcd -database some-database \
 -copy_collections true -ssl true \
 -copy_metadata true -copy_properties true

What should I do so that the imported documents will retain their collection and URIs?


Solution

  • You can set the output_type to document or archive.

    -output_type string

    The type of output to produce. Accepted values: document, archive. Default: document.

    When you export the docs with output_type of document it only writes the document content and does not export the additional information maintained within the database.

    When you set the output_type to export to an archive, it will retain the collections, permissions, metadata, properties, and quality for those documents.

    -output_type archive
    

    https://docs.marklogic.com/guide/mlcp-guide/en/exporting-content-from-marklogic-server/exporting-to-an-archive.html

    and then you can import content from that archive:

    https://docs.marklogic.com/guide/mlcp-guide/en/importing-content-into-marklogic-server/loading-content-and-metadata-from-an-archive.html