我正在做一个grails/mongodb项目。我想在mongodb数据库上做一个全文研究,使用:
db.test.runCommand( "text", { search : "my_texte" } )问题是我不知道如何在groovy (或使用gmongo)中做到这一点。
如何从groovy执行"runCommand“?
谢谢。
发布于 2014-03-26 22:37:06
我找到了可以工作的Java版本:
DBObject searchCmd = new BasicDBObject();
searchCmd.put("text", "test");
searchCmd.put("search", "mytexte");
CommandResult res = db.command( searchCmd )发布于 2014-03-26 07:29:36
因为这只是Java驱动程序的包装器,所以大部分文档都是there。
只需将其转换为"Groovy“形式:
db.command( "text", [ search: "mytexte" ] )https://stackoverflow.com/questions/22647912
复制相似问题