0

I am getting this error while creating index for search query. I wanted to make autocmplete for my search engine but mongo db keeps on throwing this error.

Here is my code:

    const tracks = db.collection("tracks")
    await tracks.createIndex({
        "info.title": "autocomplete",
        artist: "autocomplete",
        genre: "autocomplete",
        sid: "autocomplete",
    })
Doug
  • 14,387
  • 17
  • 74
  • 104
Billjesh Baidya
  • 189
  • 1
  • 12

1 Answers1

1

autocomplete is a MongoDB Atlas Search feature.

You need to create your index through the Atlas API or UI.

https://docs.atlas.mongodb.com/reference/atlas-search/create-index/

Doug
  • 14,387
  • 17
  • 74
  • 104