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

Geo searches going from v4 => v5

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Blocker - P1 Blocker - P1
    • 12_01_17
    • Affects Version/s: 5.1.0
    • Component/s: None
    • Environment:
      MongoDB 3.0, Rails 4.2

      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

            Assignee:
            Unassigned Unassigned
            Reporter:
            d_rems@yahoo.com Damjan Rems
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: