LinqToMongo.Inject does not work with 2dsphere

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.7.2
    • Component/s: LINQ
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      We used to be able to do the following in version 2.4 :

       

      var filter = Query<TEntity>.Near(field, point, rangeInMeters);
      var query = collection.AsQueryable().Where(x => locationClause.Inject());
      

      Now in 2.7, when we do this :

       

      var filter = Builders<TEntity>.Filter.Near(field, point, rangeInMeters);
      var query = collection.AsQueryable().Where(x => filter.Inject());
      

      we get the following error:

      $near is not allowed inside of a $match aggregation

       

      Query being injected:

      { "$match" : { "Location" : { "$near" : { "$geometry" : { "type" : "Point", "coordinates" : [-73.656500000000008, 45.567100000000003] }, "$maxDistance" : 10000.0 } } } }
      

       

       

            Assignee:
            Unassigned
            Reporter:
            Frederic Samson [X]
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: