I need to export all the documents from the database except documents from specific collection.
Let's say, I have a collections called test1
(100 docs), test2
(200 docs) and test3
(100 docs)
As per my requirement, I want to export all the documents from test1
and test2
collection and not from test3
collections.
Is it possible to do this using MLCP ?
I would apply a -query_filter
with a cts:and-not-query()
specifying the positive and negative cts:collection-query()
queries.
cts:and-not-query(
cts:collection-query(("test1","test2")),
cts:collection-query("test3")
)
-query_filter
parameter value is the query serialized as either XML or JSON
As XML:
<cts:and-not-query xmlns:cts="http://marklogic.com/cts">
<cts:positive>
<cts:collection-query>
<cts:uri>test1</cts:uri>
<cts:uri>test2</cts:uri>
</cts:collection-query>
</cts:positive>
<cts:negative>
<cts:collection-query>
<cts:uri>test3</cts:uri>
</cts:collection-query>
</cts:negative>
</cts:and-not-query>
as JSON:
{"andNotQuery":{"positiveQuery":{"collectionQuery":{"uris":["test1", "test2"]}}, "negativeQuery":{"collectionQuery":{"uris":["test3"]}}}}