I have an objectlike this
{
prop1: true,
prop2: "string",
prop3: number
}
I give this object to Foxx in order to use its properties as filters for arango query. I use an query builder as of the following
var qb = require('aqb');
var querybuilder=qb.for("doc").in(docCollection);
//Loop through the object property
for(var property in object){
if (object.hasOwnProperty(property)){
var value= object[property];
var key="doc."+property;
querybuilder=querybuilder.filter(qb.eq(key,value));
}
}
But this one wont work because qb.eq(key,value)
is not accepted qb.eq(key,qb.str(value))
then it is okay but the filter now filters only against string type value.
How can I build an query that filter using the exact type of value in filter object?
God, I solved this literraly 3 seconds after posting. All I have to do is to do any conversion like this
And arango does the rest.