This is good, was unaware of the multi-row result standard.
How does this work with other DBs? for example, if you have two result sets:
{ "name": "hamid", "value": "test" }
{ "name": "viktor", "value": "test2" }

should it return as below?
hamid,test,viktor,test2

Regarding the 'db_common_expand' line, I used the same function used for the 
SQL dict,
to support expansions like %s , %u and such for mongodb search filter, if that 
makes sense.

Regards
Hamid Maadani


June 15, 2022 1:46 PM, "Viktor Dukhovni" <postfix-us...@dukhovni.org> wrote:

> On Wed, Jun 15, 2022 at 04:22:11PM +0000, Hamid Maadani wrote:
> 
>> I have developed a MongoDB module for postfix. Given that
>> mongo-c-driver has gone mainstream on most linux distributions, I
>> personally think this would be a good addition to postfix, allowing
>> users to use MongoDB as a backend database. I am currently using it on
>> the same server sending this email from. You can review the code here
>> : https://github.com/21stcaveman/postfix/tree/mongodb
>> (https://github.com/21stcaveman/postfix/tree/mongodb)
> 
> How does it handle multi-row result sets? The expectation with other
> Postfix databases is that the results will be combined with
> comma-separators. I don't see where that logic is in the code...
> 
> Can you explain:
> 
> https://github.com/vdukhovni/postfix/compare/master...21stcaveman:mongodb#diff-4b022a4dceb7c17dc27bd
> 01f3e5563bf43bc485b631c060075444e986ca673dR166
> 
> And returning no rows is definitely normal and expected, and you should
> then (as you do) return a NULL result.
> 
> On Wed, Jun 15, 2022 at 03:17:00PM -0400, Wietse Venema wrote:
> 
>> Hopefully your code supports the "common" dictionary features (comon
>> for LDAP, *SQL*). I recall working on a contributed driver that did
>> not do that; it would be difficult for me to add that code and test
>> it, because I do not have every possible databse.
> 
> It does appear to the db_common parser infrastructure:
> 
> https://github.com/vdukhovni/postfix/compare/master...21stcaveman:mongodb#diff-4b022a4dceb7c17dc27bd
> 01f3e5563bf43bc485b631c060075444e986ca673dR112-R124
> https://github.com/vdukhovni/postfix/compare/master...21stcaveman:mongodb#diff-4b022a4dceb7c17dc27bd
> 01f3e5563bf43bc485b631c060075444e986ca673dR166
> 
> --
> Viktor.

Reply via email to