[OpenSIPS-Users] raw mongodb query json parse error

Liviu Chircu liviu at opensips.org
Thu Dec 7 05:27:28 EST 2017


Hi Jayesh,

I completely missed this idea during the module upgrade to libmongoc 
1.6. I don't immediately see a way we can make this work without some 
development so that ObjectId() is somehow tolerated within a JSON (maybe 
some JSON library parsing flag? hopefully!). I've opened up an issue for 
this [1] - let's move the discussion over there.

Best regards,

[1]: https://github.com/OpenSIPS/opensips/issues/1229

Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com

On 01.12.2017 14:21, Jayesh Nambiar wrote:
> 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
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

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


More information about the Users mailing list