Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-4235

Geo searches going from v4 => v5

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Blocker - P1
    • Resolution: Works as Designed
    • Affects Version/s: 5.1.0
    • Fix Version/s: 12_01_17
    • Component/s: None
    • Labels:
    • Environment:
      MongoDB 3.0, Rails 4.2

      Description

      I have started moveing old project from mongoid 4 to mongoid 5. The project is using geospatial search with additional fts search of returned results. The query looks like this:

       docs = Adress.collection.aggregate(
      {"$geoNear" => {'near' => @coordinates, 'maxDistance' => 0.2, 'distanceField' => 'distance', 'limit' => 10000 }},
      {"$match"   => { 'fts' => { "$regex" => /#{@isci}/}} },
      {"$limit"   => 10 } 
      ).to_a
      

      I have found out that aggregate syntax has changed and that parameters are now passed as array, but then all kind of other errors appear.

      Can you please help me how to define this query in mongoid 5, since documentation and examples are almost nonexisting.

      Thanks
      Damjan Rems

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            ther Damjan Rems
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: