Loading TOC...


   $partition-key as cts.reference,
   $lower-bound-included as Boolean
) as element(db.assignmentPolicy)


This function returns an element that represents the range assignment policy. Use the admin.databaseSetAssignmentPolicy function to set the assignment policy.

$partition-key This parameter specifies the cts reference that will be used as the partition key. It can be an element range index, an attribute range index, a field range index or a path range index. The range index can have any data type except for geospatial types.
$lower-bound-included If this paramenter is true, ranges on all forests in the database have closed lower bounds and open upper bound; if it is false, ranges on all forests in the database have open lower bounds and closed upper bounds.

For example, if the partition range is 2011-01-02 (lower) to 2011-01-02 (upper) and lower-bound-include is set to false, documents with partition key value of 2011-01-02 will not be included in the partition, but documents with a partition key value of 2011-01-03 and 2011-01-02 will be included.


const admin = require('/MarkLogic/admin');

// An element range index is already configured.
const config = admin.getConfiguration();
const dbId = admin.databaseGetId(config, 'db1');

// Range assignment policy doesn't work with fast locking; use "strict" or no locking instead.
const setLock = admin.databaseSetLocking(config, dbId, 'strict');
const ref = cts.elementReference(fn.QName('uri', 'localname'));
const rangePolicy = admin.rangeAssignmentPolicy(ref, true);
const setAssign = admin.databaseSetAssignmentPolicy(setLock, dbId, rangePolicy);



Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.