How to execute full text search command in MongoDB with Java Driver ?

后端 未结 1 860
被撕碎了的回忆
被撕碎了的回忆 2021-01-05 15:37

Mongo and Java gurus. Our team decided to use full text search API, introduced recently in MongoDB. However, we found some difficulties executing the command using the Java

相关标签:
1条回答
  • 2021-01-05 16:18

    Taken from a post on the Google group ( https://groups.google.com/forum/?fromgroups#!topic/mongodb-user/7jWUbunUcFQ ):

        final DBObject textSearchCommand = new BasicDBObject();
        textSearchCommand.put("text", collectionName);
        textSearchCommand.put("search", textToSearchFor);
        final CommandResult commandResult = db.command(textSearchCommand);
    

    Shows exactly how to format the command.

    0 讨论(0)
提交回复
热议问题