Reputation: 5761
I want to retrieve all documents in my MarkLogic db that have month=November and also group them by name, and get the count of records per name. I know I can get the frequency per name by using valuesBuilder with a range index on the name field, but how can I filter this result so that I only get the count of records for the month of November?
Supposedly valuesBuilder.fromIndexes().where() can do the filtering, but I don't know what to pass here and examples online seem to be sparse.
Upvotes: 1
Views: 67
Reputation: 8422
According to the API doc, the where clause takes a queryBuilder.query. With that in mind, you should be able to do something like this (not tested):
var marklogic = require('marklogic');
var vb = marklogic.valuesBuilder;
var qb = marklogic.queryBuilder;
vb
.fromIndexes()
.where(qb.value('month', 'November'))
Upvotes: 3