Donutloop
Donutloop

Reputation: 451

MongoDB 3.6 autocomplete failed "Command failed with error 40324"

I used the basic autocomplete example provided by MongoDB. Unfortunately, it's causing an exception on the server-side

    db.movies.aggregate([
  {
    $search: {
      "autocomplete": {
        "path": "title",
        "query": "off"
      }
    }
  },
  {
    $limit: 10
  },
  {
    $project: {
      "_id": 0,
      "title": 1
    }
  }
])

Ref: https://docs.atlas.mongodb.com/reference/atlas-search/autocomplete/

org.graalvm.polyglot.PolyglotException: Command failed with error 40324 (Location40324): 'Unrecognized pipeline stage name: '$search'' on server localhost:27017. The full response is {"ok": 0.0, "errmsg": "Unrecognized pipeline stage name: '$search'", "code": 40324, "codeName": "Location40324"}

any ideas, how to solve this?

Upvotes: 0

Views: 1730

Answers (1)

D. SM
D. SM

Reputation: 14490

Atlas Search is an Atlas feature. It is not provided by MongoDB binaries you can download.

You can use https://docs.mongodb.com/manual/text-search/ in both environments (though it is not as powerful) or use Atlas for development & staging.

Upvotes: 1

Related Questions