如何使用MongoDB runCommand方法?
我正在使用db.col.runCommand("text",{search:"searchword"})从MongoDB控制台执行全文搜索。但是我想在Java中使用这个命令,有人能建议我如何在Java中使用这个命令吗?
发布于 2013-06-28 17:18:25
您可以尝试这样做:
DBObject searchCmd = new BasicDBObject();
searchCmd.put("text", collection); // the name of the collection (string)
searchCmd.put("search", query); // the term to search for (string)
CommandResult commandResult = db.command(searchCmd);https://stackoverflow.com/questions/17361136
复制相似问题