本文介绍了MongoDB:在文档字段中执行文本搜索(使用高级API)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

可能与此问题有关使用OPA MongoDB高级API的基本GROUP BY语句.

我希望能够检索名称"字段值包含给定字符串的文档列表.

I want to be able to retrieve a list of documents which "name" field value contains a given string.

这是我的文件清单:

{name: "Charles-Hugo"},{name: "Jean Pierre"},{name: "Pierre Dupont"},

{name: "Charles-Hugo"},{name: "Jean Pierre"},{name: "Pierre Dupont"},

我希望只能检索名称包含"Pierre"字符串的文档:Jean Pierre和Pierre Dupont.

I want to be able to only retrieve documents which name contains the "Pierre" string: Jean Pierre, and Pierre Dupont.

我知道MongoDB高级API不可能做到这一点.我已经研究了低级API函数,但是我不知道以安全的Opa类型检索文档的最简单方法是什么.

I know this isn't possible with the MongoDB high-level API.I've looked in the low-level API functions but I don't know what's the easiest way to retrieve my documents in safe Opa type.

我还要在查询中添加跳过/限制选项.

Also I'd like to add skip/limit options to my query.

有什么主意吗?

推荐答案

Opa中的DbGen自动化机制对此提供了支持:

The DbGen automation mechanism in Opa has support for this:

DbSet.iterator(/path/data[name =~ pattern])

这篇关于MongoDB:在文档字段中执行文本搜索(使用高级API)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 23:56