mardi 24 mars 2015

possible to print created filter for rethinkdb for debugging purposes?


Vote count:

0




Using node I'm trying to programmatically creating a filter which fails. Is there a way to check the output of a filter as it is passed to RethinkDB? That way I can try to debug the filter.


Background I'm trying to write a helper that, given nested object notation a.b matches against a given value.


E.g.: I'm trying to create the following filter:


entry("a")("b").match(val)


Using the helper:



function iterateProp(entry, path, val) {
if (path.length) {
var propKey = path.shift();
return iterateProp(entry(propKey), path, val);
}
return entry(val);
}


Called as such:



Model.filter(function(entry) {
var modelKey = "a.b"; //illustrational
var val ="someValToMatch"; //illustrational
var filter = iterateProp(entry, modelKey.split("."), val);
console.log("filter", filter); //HOW TO DISPLAY FILTER AS CONSTRUCTED BY RETHINKDB DRIVER AND SEND TO RETHINKDB?
return filter;
})


This should just work in my book, but it doesn't. So how to display the constructed filter so I can do some debugging?



asked 34 secs ago

Geert-Jan

6,177






possible to print created filter for rethinkdb for debugging purposes?

Aucun commentaire:

Enregistrer un commentaire