Hi there,
Question: is it possible to load a htable, defined by columns, from a MongoDB collection, when a certain "column" is an object with multiple elements?
For example: modparam("htable", "htable", "users=>size=10;dbtable=users;cols='FirstName,LastName,Location:Prefix';")
Fails when trying to load the value of Location.Prefix
{ "FirstName": "John", "LastName": "Doe", "Language" : "en", "Location" : { "Country" : "USA", "City" : "New York", "Prefix" : "+1" } }
Thanks in advance.
Hi Sergiu,
I did not try it by myself so far, maybe others can comment on it. Normally you should be able to use the htable module on all usual database modules (that offer the needed capabilities). What are the error messages that you get, maybe there are some hints in it?
Cheers,
Henning
-- Henning Westerholt – https://skalatan.de/blog/ Kamailio services – https://gilawa.comhttps://gilawa.com/
From: sr-users sr-users-bounces@lists.kamailio.org On Behalf Of Sergiu Pojoga Sent: Tuesday, March 2, 2021 4:39 PM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Subject: [SR-Users] Load htable from MongoDB
Hi there,
Question: is it possible to load a htable, defined by columns, from a MongoDB collection, when a certain "column" is an object with multiple elements?
For example: modparam("htable", "htable", "users=>size=10;dbtable=users;cols='FirstName,LastName,Location:Prefix';")
Fails when trying to load the value of Location.Prefix
{ "FirstName": "John", "LastName": "Doe", "Language" : "en", "Location" : { "Country" : "USA", "City" : "New York", "Prefix" : "+1" } }
Thanks in advance.
Hi Henning,
Well, it works fine if the document is a "flat JSON" without arrays and other sub-objects in it. I tried with and without escaping quotation marks, but no luck.
ERROR: db_mongodb [mongodb_dbase.c:452]: db_mongodb_get_columns(): field ["Location":"Prefix"] not found in result iterator
ERROR: db_mongodb [mongodb_dbase.c:452]: db_mongodb_get_columns(): field [Location:Prefix] not found in result iterator
Regards, --Sergiu
On Tue, Mar 2, 2021 at 12:11 PM Henning Westerholt hw@skalatan.de wrote:
Hi Sergiu,
I did not try it by myself so far, maybe others can comment on it. Normally you should be able to use the htable module on all usual database modules (that offer the needed capabilities).
What are the error messages that you get, maybe there are some hints in it?
Cheers,
Henning
--
Henning Westerholt – https://skalatan.de/blog/
Kamailio services – https://gilawa.com
*From:* sr-users sr-users-bounces@lists.kamailio.org *On Behalf Of *Sergiu Pojoga *Sent:* Tuesday, March 2, 2021 4:39 PM *To:* Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org *Subject:* [SR-Users] Load htable from MongoDB
Hi there,
Question: is it possible to load a htable, defined by columns, from a MongoDB collection, when a certain "column" is an object with multiple elements?
For example:
modparam("htable", "htable", "users=>size=10;dbtable=users;cols='FirstName,LastName,Location:Prefix';")
Fails when trying to load the value of Location.Prefix
{ "FirstName": "John", "LastName": "Doe", "Language" : "en", "Location" : { "Country" : "USA", "City" : "New York", "Prefix" : "+1" } }
Thanks in advance.