node.js - Marklogic QueryByExample in collection NodeJS -
tldr
is there way limit querybyexample collection in nodejs?
problem faced
i have complex query optional fields (i.e. search fields omitted). need create query dynamically, e.g. in json. querybyexample seems right tool use here gives me flexibility pass json. problem limit search 1 collection or directory.
e.g. hoping like
searchjson = { title: { $word: "test" }, description: { $word: "desc" } }; //query db.documents.query(qb.where( qb.collection("collectionname"), qb.byexample(searchjson) )).result()...
in case searchjson
have been built dynamically, example maybe title may omitted search.
this doesn't work because query builder allows querybyexample query. i'd instead built dynamic search query limited collection or directory.
at present, think have express query querybuilder instead of query example using
qb.and([ qb.collection('collectionname'), qb.word('title', 'test'), qb.word('description', 'desc') ])
see http://docs.marklogic.com/jsdoc/querybuilder.html#word
that said, should possible node.js api relax restriction based on fixes in marklogic 9.0-2
please file issue on https://github.com/marklogic/node-client-api
Comments
Post a Comment