craiggwilson/fluent-mongo — Issue #52: Problem with rewriting query expressions
Author: object
Created: 2012-02-29 19:05:35+00:00
State: open

Hello,

This is an unusual scenario that does not happen under normal use of Fluent-Mongo. I am writing a MongoDB adapter for OData and consider your LINQ provider because I need an IQueryable interface to MongoDB collections. But I need an IQueryable, not an IQueryable.

The problem with IQueryable is that although it is supported, in your tests you are using internal class BsonDocumentQuery to build expressions. If I don't use BsonDocumentQuery and use notation Where(x => x.GetValue("key")), then Mongo query provider raises "Not supported" exception its expression visitor.

So I am stuck for the moment and would like to find a decent solution. The easiest would be to make BsonDocumentQuery public, this will open for use of its Key extension method. An alternative is to change the visitor so it accepts GetValue. Otherwise it looks like the driver does not support IQueryable, only custom types.

Please let me know what you think about it. If you want, I can investigate it more and submit a pull request.