课程: Advanced MongoDB: Efficient and Secure Data Management

今天就学习课程吧!

今天就开通帐号,24,100 门业界名师课程任您挑!

Text index

Text index

- [Instructor] A text index supports queries on string content and can be built on fields that contain strings or arrays of strings. Let's look at that in the terminal. We are going to use a collection that we imported data for in the beginning of this course. And that's the filme collection. Filme is the German word for movies, and why we're using German data will become clear in a little bit. So for now, just say db.filme.findOne. Okay, so this is what the data looks like. It's got a title, the movie title, release_date, length, a genre and some description. Cool, so now let's create a text index on that. The way we do that is we say db.filme and we call the createIndex method on there. Inside this, we have to specify two parameters. The first one is the fields that contain text that we want to create the index on. In this case, it's going to be the title, and that contains text and the description. And that…

内容