xdmp:document-partition-assign( $root as node(), [$partition-queries as map:map] ) as xs:unsignedInt?
Assign a document to a partition number, using the partition queries in the database or in the second argument. The return value is the partition number where the document should be inserted.
Parameters | |
---|---|
root | The document to assign. |
partition-queries | A map of partition-number to cts query. |
xdmp:document-partition-assign("<top><a>hello world</a></top>") => 2
xquery version "1.0-ml"; let $map := map:map() let $put := map:put($map,"1", cts:element-range-query( xs:QName("create-time"), ">=", xs:dateTime("2014-01-01T00:00:00"))) let $put := map:put($map,"2", cts:element-range-query( xs:QName("create-time"), ">=", xs:dateTime("2013-01-01T00:00:00"))) return xdmp:document-partition-assign( <root> <name>test1</name> <create-time>2013-07-05T00:00:00</create-time> </root>, $map ) =>2