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

Lars Olsson lars.olsson at optimobile.se
Wed Nov 6 12:53:19 CET 2019


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20191106/c5ef91d5/attachment.html>


More information about the sr-users mailing list