CJ Chang
CJ Chang

Reputation: 386

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?

Upvotes: 2

Views: 36

Answers (1)

Mads Hansen
Mads Hansen

Reputation: 66781

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:

  • Set -input_compressed to true.
  • Set -input_file_type to archive.

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

Upvotes: 4

Related Questions