db-migrate / mongodb

mongodb driver for db-migrate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to create a text index on a field?

Ge0 opened this issue · comments

Hi there,

How can I use db-migrate to create a text index on a field like specified in the doc here? https://docs.mongodb.com/manual/core/index-text/#create-text-index

I am struggling with the available methods and as far as I understand, one can only create an index on a field in order to set it as unique, but no more.

If you have any clue I’d be happy.

Well nevermind:

db.addIndex('campaigns', 'title_text', {title: 'text'}, false)

Worth specifying somewhere in some relevant documentation.

Thanks!