diff --git a/lib/Drivers/DML/mongodb.js b/lib/Drivers/DML/mongodb.js index 71ecfbd9..45fc3657 100644 --- a/lib/Drivers/DML/mongodb.js +++ b/lib/Drivers/DML/mongodb.js @@ -389,7 +389,7 @@ function convertFromDB(obj, timezone) { function convertToDBVal(key, value, timezone) { if (value && typeof value.sql_comparator == "function") { - var val = (key != "_id" ? value.val : new mongodb.ObjectID(value.val)); + var val = (key != "_id" ? value : new mongodb.ObjectID(value)); var comp = value.sql_comparator(); var condition = {}; @@ -399,10 +399,10 @@ function convertToDBVal(key, value, timezone) { case "lt": case "lte": case "ne": - condition["$" + comp] = val; + condition["$" + comp] = val.val; break; case "eq": - condition = val; + condition = val.val; break; case "between": condition["$min"] = val.from;