[OpenSIPS-Users] raw mongodb query json parse error

Jayesh Nambiar jayesh1017 at gmail.com
Fri Dec 1 07:21:54 EST 2017


Hi All,
I've been playing around with executing raw mongodb queries with opensips
2.3.2. Though I can run and execute queries successfully I cannot figure
how to write a query that queries the objectId in mongodb directly.
The raw query basically is:

db.runCommand({ find: "customers", filter: {
"_id":ObjectId("5a212d183f1e5e1c7b11b194") } });

But When i write it in the script as:

cache_raw_query("mongodb:instance1", "{ \"find\": \"customers\",
\"filter\": { \"_id\": ObjectId(\"5a212d183f1e5e1c7b11b194\")
}}","$avp(out)");

opensips gives json parsing error. It basically expects the entire ObjectId
string to be in inverted commas to be a valid json. Any ideas on how to
successfully write the above working query in opensips to pass as a raw
query.

Thanks,

- Jayesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20171201/f0fcb332/attachment-0001.html>


More information about the Users mailing list