Unknown index plugin 'autocomplete' MongoDB

618 Views Asked by At

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",
    })

1

There are 1 best solutions below

0
On

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/