SIMPLE IQueryable implementation for the MongoQuery

Issue #1 resolved
David Rundle created an issue

the mongo interface does not support all the functionality that Linq can provide.

Planned support

mongo query object (done)

directly support an object which support the Mongo Query object

  • Selector (IDictionary<string,object>)
  • Skip (long or int)
  • Take (long or int)
  • Sort by (IEnumerable<IDictionary<string, ordery>>)
  • index (string)

Query<T> (done)

the implementation needs to take into account the limited power of the mongo statement. which means we may only be able to statisfy only part of the linq query, allowing the rest to be executed in memory

  • Query<T>(string index /optional) -> returns IQueryable, note take into account base/inherited classes done
  • Where() -> each one becomes an and'ed part of the selector done
  • OrderBy -> done
  • Take Skip -> can be converted, as long as it is not after a Select done
  • Index -> selecting an index. basic done

  • string -> startswith, endwith, equals and contains - done

  • collections -> collection.Any(x.Name) and x.Names.Any(x=> x == "dave") done

//need to list interactions for each, will try and use tests to help show this.

Mapping (done)

this is a first time, basically if we are to support Query<Animal>().Take(10).ToList(), we will need to find all the objects which inherit Animal.

note the inital idea is to support a way to scan for types and auto set them up. but also allow the user to specifiy nicely what is the Id and Rev fields. thats the current scope.

Comments (9)

  1. David Rundle reporter
    • edited description

    currently looking into

    Order by, this is tricky, as you have to live by the constrains of Couchdb. implemented some of the code for this, but need to alter the tests to confirm the couchdb intended useage

    Selector for collections, example

    session.Query<Book>().Where(x => x.editions.Any(e => e.type == electronic) );
    
  2. David Rundle reporter

    Most of this support is avaliable in version 0.5.x

    0.6.x contains fixes for sorting. and index supporting, see issue #4 for more information on that

  3. Log in to comment