Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-2441

LinqToMongo.Inject does not work with 2dsphere

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • 2.7.2
    • Linq
    • None

    Description

      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 } } } }
      

       

       

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: