Geonear and Text Search

65 views
Skip to first unread message

Rebin Joseph

unread,
Aug 13, 2016, 6:18:34 AM8/13/16
to mongodb-user
I have tried to implement geonear with text search and it returns pipeline issue. I want to find locations in 100 km radius with a text search with sort order of distance, I received following error

(Text search) The $match stage that includes a $text must be the first stage in the pipeline.

(Geo search) You can only use $geoNear as the first stage of a pipeline.

Any way to do this ?

John Murphy

unread,
Aug 18, 2016, 4:18:31 AM8/18/16
to mongodb-user

Hi Rebin,

Currently the aggregation framework is limited to use one special index as the first pipeline stage. Since full-text index and geospatial index classify as special indexes, presently they cannot be used together in a single aggregation query. See Queries cannot use both text and Geospatial Indexes for more information.

Could you elaborate on what you are trying to achieve? It will be helpful if you can post information such as:

  • Your MongoDB version
  • Which MongoDB driver you are using
  • Example documents that should and should not match your query
  • What you have tried so far

Regards,
John Murphy

Reply all
Reply to author
Forward
0 new messages