[SR-Users] ndb_mongodb -Sending Query to Mongo
Jonathan Hunter
hunterj91 at hotmail.com
Thu Sep 22 12:06:28 CEST 2016
Hello,
Ok cool thanks Daniel will do that.
Cheers
Jon
To: sr-users at lists.sip-router.org
From: miconda at gmail.com
Date: Thu, 22 Sep 2016 07:28:19 +0200
Subject: Re: [SR-Users] ndb_mongodb -Sending Query to Mongo
Hello,
in case of ndb_mongodb, the result is the json returned by the
server. Maybe you can run with debug=3 and see if you can get more
info about what happens there.
To access part of result, you need to use a json module over
$mongodb(mgr1=>value).
Cheers,
Daniel
On 21/09/16 14:36, Jonathan Hunter
wrote:
Hi Guys,
I am using the ndb_mongodb module, and Im just trying to
return values from the dispatcher table, in particular the
setid of a particular entry depending on its attrs value.
If I query using mongodb shell command it works fine, here
I enter test.com and it returns only the setid value, or 2;
db.dispatcher.find( { attrs: "test.com" }, { setid: 1, _id:
0 } )
{ "setid" : 2 }
However I have been having issues getting this to work
using mongodb_find_one, as I would of thought the following
route return the same;
if(mongodb_find_one("ml-mongodb", "kamailiosbc",
"dispatcher", "{ \"attrs\" : \"test.com\" },{ \"setid\":
\"1\", \"_id\": \"0\" }", "mgr1"))
However it returns all the entries relating to that attrs
columm from dispatcher table, instead of just setid.
Is it possible to do this? I am stuggling to find the json
format to acheive the same thing.
Also in terms of the mgr1 response, I see its contained
within the $mongodb(key), can I drill down to get
specific fields from it or would I need to use
transformations or jansson to do this?
Many thanks
Jon
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users at lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, Berlin, Oct 24-26, 2016 - http://www.asipto.com
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users at lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20160922/942a5076/attachment.html>
More information about the sr-users
mailing list