Closed csreddy closed 9 years ago
Thanks for exercising the API.
I believe the test case should be:
q.parsedFrom('coll:"matchCollection1"',
q.parseBindings(
q.collection(q.bind('coll'))
)
)
When you supply a q.bind() binding on q.collection, the optional string argument is a prefix, as in:
q.parsedFrom('coll:"suffix"',
q.parseBindings(
q.collection(q.bind('coll'), '/prefix/')
)
)
yielding cts:collection-query("/prefix/suffix") as in your test case.
It would be inconvenient to have to supply the same query criteria both as part of the query text and as a query parameter.
See: http://docs.marklogic.com/jsdoc/queryBuilder.html#collection
Unless you disagree because I've misunderstood, please close the bug.
I was kind a mislead by the similar signature of other queries, such as q.value('category', q.bind('cat'))
, q.word('title', q.bind('title'))
and q.range(q.pathIndex('/priority/level'), q.bind('p'))
which take the first parameter as the property name, so I assumed for collection, the first param must be the collection name as suggested even by the docs. Thanks Erik
Here's the test case:
Here's the query plan:
The root cause is that its doing collection query on
cts:collection-query(\"matchCollection1matchCollection1\")
instead ofcts:collection-query(\"matchCollection1\")