简体   繁体   English

mongodb gmongo runCommand

[英]mongodb gmongo runCommand

I'm working on a grails/mongodb project. 我正在研究grails / mongodb项目。 I want to do a full text research on a mongodb database using: 我想使用以下方法对mongodb数据库进行全文研究:

db.test.runCommand( "text", { search : "my_texte" } )

The problem is that I didn't found how to do it in groovy (or using gmongo). 问题是我没有找到如何在groovy(或使用gmongo)中做到这一点。

How do execute a "runCommand" from groovy ? 如何从groovy执行“runCommand”?

Thanks. 谢谢。

Since this is just a wrapper around the Java driver so most of the documentation is there . 因为这只是Java驱动程序的包装器所以大部分文档都在那里

Just translate into the "Groovy" form: 只需翻译成“Groovy”形式:

db.command( "text", [ search: "mytexte" ] )

I have found the Java version which works: 我找到了适用的Java版本:

DBObject searchCmd = new BasicDBObject();
searchCmd.put("text", "test"); 
searchCmd.put("search", "mytexte"); 
CommandResult res = db.command( searchCmd )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM