[SR-Users] MongoDB findone(). Is projection supported?

Daniel-Constantin Mierla miconda at gmail.com
Wed Nov 6 18:33:51 CET 2019


The code has a define/macro compile time option for returning one result
-- see:


  -
https://github.com/kamailio/kamailio/blob/master/src/modules/ndb_mongodb/mongodb_client.c#L293-L317


I see that the define is on version 1.5.0, maybe that needs to be changed.

The commit introducing it is:
  -
https://github.com/kamailio/kamailio/commit/c70d831aee5a95613de69568d8f1863788e0a074

I am not able to verify the code/docs of the library at this moment to
see what exactly should be used for that version to retrieve one record.
Can you test with newer library version or check docs/code if there are
known limitations of your specific version?

Cheers,
Daniel

On 06.11.19 13:48, Lars Olsson wrote:
> Using Debian Stretch default:
>
> libmongoc-1.0-0/oldstable,now 1.4.2-1+b1 amd64 [installed,automatic]
>
> Kamailio 5.1.9
>
> Best Regards
> Lars
> ------------------------------------------------------------------------
> *From:* Daniel-Constantin Mierla <miconda at gmail.com>
> *Sent:* Wednesday, November 6, 2019 1:29 PM
> *To:* Kamailio (SER) - Users Mailing List
> <sr-users at lists.kamailio.org>; Lars Olsson <lars.olsson at optimobile.se>
> *Subject:* Re: [SR-Users] MongoDB findone(). Is projection supported?
>  
>
> Hello,
>
>
> what is the version of mongo c library?
>
>
> Cheers,
> Daniel
>
>
> On 06.11.19 12:53, Lars Olsson wrote:
>> Hi,
>>
>> I am using NDB_MONGODB to ask some questions to a database.
>> My database structure is pretty heavy, so I like to return as little
>> data as required to Kamailio.
>>
>> I have tried the following MongoDB syntax for projection to include
>> only given (my_field) column in the response.
>>
>> mongodb_find_one("srv_name", "database", "collection", "{ \"user_id\"
>> : \"$var(user_id)\" }, { \"my_field\" : 1}", "mgr1")
>>
>> I always get full DB entry back. Is this supported?
>> The same string works OK in the vanilla mongo client.
>>
>> How can I limit the result?
>>
>>
>> Thanks
>> Lars
>>
>> _______________________________________________
>> Kamailio (SER) - Users Mailing List
>> sr-users at lists.kamailio.org <mailto:sr-users at lists.kamailio.org>
>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
> -- 
> Daniel-Constantin Mierla -- www.asipto.com <http://www.asipto.com>
> www.twitter.com/miconda <http://www.twitter.com/miconda> -- www.linkedin.com/in/miconda <http://www.linkedin.com/in/miconda>
> Kamailio World Conference - April 27-29, 2020, in Berlin -- www.kamailioworld.com <http://www.kamailioworld.com>

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio World Conference - April 27-29, 2020, in Berlin -- www.kamailioworld.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20191106/5466342d/attachment.html>


More information about the sr-users mailing list