软件下载吧文章资讯

分类分类

MongoDB学习之Text Search文本搜索功能

2024-03-04 00:33作者:下载吧

前言

MongoDB支持对文本内容执行文本搜索操作,其提供了索引text index和查询操作$text来完成文本搜索功能。下面我们通过一个简单的例子来体验一下MongoDB提供的全文检索功能。

方法示例

1.新建blogs collection,并插入如下的document。

db.blogs.insert({_id:1,title:”MongoDB text search”,content:”this is a simple MongoDB text search introduction”})

db.blogs.insert({_id:2,title:”MongoDB text index”,content:”this is ae MongoDB text index introduction”})

db.blogs.insert({_id:3,title:”MongoDB text operators”,content:”this is ae MongoDB text query introduction”})

展开全部

相关文章

说两句网友评论
    我要跟贴
    取消