On Sun, 2011-05-22 at 00:20 +0200, Gergely Nagy wrote:
Here's what I propose: * let's use the underscore for now, key rewrite functions will come soon anyway. * let's solve the performance concerns by doing the initial dot -> underscore translation in libmongo-client, which is in a better position to do that, it really doesn't make sense to use initial dots for any future libmongo-client users anyway. That way we can do it without having to copy the value name.
We've talked about this earlier, and I spent the night brooding about this, and while it would be easy to do this in libmongo-client, I'm reluctant to do so, because it feels too much like second guessing the user. LMC is reasonably simple, and the lower level functions syslog-ng's afmongodb uses from it are like the bare metal. I really wouldn't want to add transformations like this there.
Another reason not to do transformations in libmongo-client: None of the other mongodb drivers I checked do that: they either return an error (the offical C driver does this), raise an exception (python, ruby), or leave it up to the database to fail (c++, and perl, as far as I saw).
Since none of the official drivers do transformation either, I wouldn't like libmongo-client to do it, either. Not by default anyway. I can be convinced to do .->_ mapping when 'safe mode' is enabled. (But that assumes that afmongodb will be updated to use the higher level API provided by LMC, which supports this safe mode flag)
Ok, agreed, I'll then remove my patches from libmongo-client and change the assumption in syslog-ng on how libmongo-client works, and then release 3.3beta1. -- Bazsi