Reputation: 419
Marklogic version : 9.0-6.2
My requirement is to run a property value query, but restrict to a specific collection. I tried below query hoping that the andQuery would perform intersection on the results, but I am getting back all the documents in the collection "registration".
cts.search(
cts.andQuery[(
cts.collectionQuery("registration"),
cts.jsonPropertyValueQuery("RegistrationId","reg1"))
]
)
Also, even if it works with a tweak, it doesn't seem to be an efficient way of getting just one required document (cts.jsonPropertyValueQuery always returns only 1 document in above query). Any suggestions on the best way to restrict cts.jsonPropertyValueQuery to a specific collection?
Upvotes: 1
Views: 76
Reputation: 2192
You have a typo in your query. Try this one ;)
cts.search(
cts.andQuery([
cts.collectionQuery("registration"),
cts.jsonPropertyValueQuery("RegistrationId","reg1")
])
)
Upvotes: 2