The $near query works from the shell but complains that it can't find index from morphia

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: 3.2.0
    • Component/s: None
    • Environment:
      eclipse, mongodb on rhel, morphia 1.0.1
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Following is the morphia query:

      final Query<Node> getNodesQuery = datastore.createQuery(Node.class).
      field("point.coordinates").near(-71.097825, 42.386532);//, radius);
      return getNodesQuery.asList();

      Following is the shell query:
      db.nodes.find( { point : { $near : { $geometry :

      { type : "Point" , coordinates : [-71.097825, 42.386532] }

      , $maxDistance : 50 } } } )

      And the error:
      Exception in thread "main" com.mongodb.MongoQueryException: Query failed with error code 17007 and error message 'Unable to execute query: error processing query: ns=nodal_scoring_db_v2.nodes limit=0 skip=0
      Tree: GEONEAR field=point.coordinates maxdist=1.79769e+308 isNearSphere=0
      Sort: {}
      Proj: {}
      planner returned error: unable to find index for $geoNear query'

              Assignee:
              Unassigned
              Reporter:
              riju pahwa
              None
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: