Hi everybody,
I normally use MongoDB as DB engine in my projects and I would like to get all MongoDB advantages when working with Kamailio. For this reason, I need to deal with arrays of information inside a document (for example, an array of contacts inside a document).
And now the question: is it possible to insert, update and search info in a MongoDB document by using arrays via srdb1 lib? If yes, how? And if not, are you thinking about implementing it in the future?
Thank you very much for your time.
Regards, Mario
Hello,
why do you would like to use the generic Kamailio DB1 (v1) API with db_mongodb, when there is a ndb_mongodb module available which supports native queries and also provide functions to iterate over multiple documents?
Cheers,
Henning
-----Original Message----- From: Mario Pereira via sr-dev sr-dev@lists.kamailio.org Sent: Montag, 5. Februar 2024 09:56 To: sr-dev@lists.kamailio.org Cc: mario.pereira@quobis.com Subject: [sr-dev] Working with arrays in MongoDB documents
Hi everybody,
I normally use MongoDB as DB engine in my projects and I would like to get all MongoDB advantages when working with Kamailio. For this reason, I need to deal with arrays of information inside a document (for example, an array of contacts inside a document).
And now the question: is it possible to insert, update and search info in a MongoDB document by using arrays via srdb1 lib? If yes, how? And if not, are you thinking about implementing it in the future?
Thank you very much for your time.
Regards, Mario _______________________________________________ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr- dev-leave@lists.kamailio.org
Hi Henning,
Thank you very much for your reply. I have a question: what do you mean when you talk about using ndb_mongodb module? Do you mean to use it from the configuration file or inside a module code? Our use case is to save all contacts related to an AOR in the same MongoDB document as an array in order to have all information inside a document and avoid the use of indexes. But, of course, we want to use the 'save' function (from registrar module) and not to launch either raw queries or ndb_mongodb commands, if possible.
Regards, Mario
Hello Mario,
if you want to use standard modules like usrloc and registrar, you need to use the db_mongodb module. This is naturally limited in its support of the mongodb specialities. If you want to get better support, you can of course use the ndb_mongodb module. You can find details about how to use it from the cfg script in the module readme.
Cheers,
Henning
-----Original Message----- From: Mario Pereira via sr-dev sr-dev@lists.kamailio.org Sent: Dienstag, 6. Februar 2024 13:35 To: sr-dev@lists.kamailio.org Cc: mario.pereira@quobis.com Subject: [sr-dev] Re: Working with arrays in MongoDB documents
Hi Henning,
Thank you very much for your reply. I have a question: what do you mean when you talk about using ndb_mongodb module? Do you mean to use it from the configuration file or inside a module code? Our use case is to save all contacts related to an AOR in the same MongoDB document as an array in order to have all information inside a document and avoid the use of indexes. But, of course, we want to use the 'save' function (from registrar module) and not to launch either raw queries or ndb_mongodb commands, if possible.
Regards, Mario _______________________________________________ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr- dev-leave@lists.kamailio.org