On Wed, Dec 06, 2023 at 08:10:22PM +0000, Hamid Maadani via Postfix-devel wrote:
> now, in my case, I'm using a docker container, and am using parameters
> in main.cf , a sample below:
> docker_va_uri = $docker_dburi
> docker_va_dbname = $docker_dbname
> docker_va_collection = mailbox
> docker_va_filter = {"$$or": [{"username":"%s"}, {"alias.address": "%s"}],
> "active": 1}
> docker_va_result_attribute = username
You're mixing up the layers. In the legacy flat "main.cf" SQL-like
table syntax, with "tablename_parameter_name" settings, yes "$" needs
to be "$$" to survive *main.cf* parameter expansion, but that is NOT
part of the underlying *table syntax*, which is what users would write
in:
main.cf:
mongodb = proxy:mongodb:${config_directory}/
virtual_alias_maps = ${mongodb}mongo-valias.cf
mongo-valias.cf:
...
filter = { $or: [ {"mail": "%s"}, { "alias": "%s" } ] }
...
And I am aslo rather puzzled by the double quotes you're putting around
`$or`. These certainly don't appear in the MongoDB documentation. I
would expect `"$or"` to be treated as a verbatim JSON key and not as a
MongoDB operator. Otherwise, we potentially have deeper quoting issues
than just double-quote and backslash characters...
--
Viktor.
_______________________________________________
Postfix-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]