mongodb/mongo-csharp-driver — pull request #100 by ray2k (2012-04-28 03:31:49+00:00)
Title: Added support for standlone ToLower/ToUpper linq comparison expressions

I needed standalone support for ToLower() == "constant" to support hosting a nuget feed over mongodb.

This adds support for things such as collection.AsQueryable().Where(p => P.Category.ToLower() == "some category").

Included tests for:
ToLower() == "lower"
ToLower() == "Not Lower"
ToLower() == null
ToLower() != "lower"
ToLower() != "Not Lower"
ToLower() == null
ToUpper() == "UPPER"
ToUpper() == "Not Upper"
ToUpper() == null
ToUpper() != "UPPER"
ToUpper() != "Not Upper"
ToUpper() != null

Translation is to regex in the form of /%constantvalue$/i except in the never-match or match-all scenerios. Translation also includes use of Query.Exists so an expression testing FooBar.ToLower()/ToUpper() will never be evaulated on a doc where FooBar element does not exist.