[OpenSIPS-Users] Last Modified AOR for User

sevpal sevpal at aol.com
Tue Feb 17 14:27:08 CET 2015


Thank you, I have it working. To complete the process though, I also needed to create a bubble sort in the script to sort the Json keys on the last_modified field.

I’d like to make a feature request for a sort facility in the raw query.  

From: Vlad Paiu 
Sent: Tuesday, February 10, 2015 4:54 AM
To: sevpal ; OpenSIPS users mailling list ; Bogdan-Andrei Iancu 
Subject: Re: [OpenSIPS-Users] Last Modified AOR for User

Hello,

Indeed, date fields where not properly supported in the cachedb_mongodb module.
I've just committed a fix for this - so please update your GIT sources to the latest ones.

I've just tested this with a small script like :

                if (!save("location"))
                        sl_reply_error();

                sleep("1");

                cache_raw_query("mongodb:instance1","{ \"op\" : \"find\", \"ns\" : \"location.location\", \"query\": {\"username\" : \"vlad\"} }","$avp(mongo_result)");                
                $json(json_res) := $avp(mongo_result);
                $avp(expiration) = $json(json_res/expires)-$Ts;
                $avp(last_edited) = $Ts-$json(json_res/last_modified);
                xlog("Username vlad will expired in $avp(expiration) seconds and was edited $avp(last_edited) seconds ago \n"); 

Best Regards,

Vlad Paiu
OpenSIPS Developer
http://www.opensips-solutions.com On 10.02.2015 04:26, sevpal wrote:

  The data in the DB are stored correctly, there aren’t any problems there, I can view all the fields properly set with “db.location.find()” . On a raw Query though, all the other fields return with Json data except the date/time fields. It seems mongo needs a different kind of directive than what is currently in the module to retrieve the data.

  From: Bogdan-Andrei Iancu 
  Sent: Monday, February 09, 2015 4:24 AM
  To: sevpal ; OpenSIPS users mailling list 
  Subject: Re: [OpenSIPS-Users] Last Modified AOR for User

  Hi Jalung,

  If you list the records in mongoDB collection, do you see the "last_modified" field properly set ? (I'm trying to understand if you have a problem with the data in DB or with the query itself)

  Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.comOn 07.02.2015 01:47, sevpal wrote:

    If I’m storing the location table in a mongodb collection, how to query the most current AOR for a user? I can query all the fields except the date/time fields eg; “last_modified”, they return empty. I’m doing this using the mongo raw  query in Opensips.

    Jalung 

     

_______________________________________________
Users mailing list
Users at lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



   

_______________________________________________
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/20150217/2103c93e/attachment.htm>


More information about the Users mailing list