Tạo Text Index trong MongoDB
Bạn theo dõi Document sau dưới posts collection chứa post_text và tags của nó.
{
"post_text": "enjoy the mongodb articles on tutorialspoint",
"tags": [
"mongodb",
"tutorialspoint"
]
}
Chúng ta sẽ tạo một Text Index trên trường post_text để mà chúng ta có thể tìm kiếm bên trong phần text của posts:
>db.posts.ensureIndex({post_text:"text"})
Last updated