MongoDB
 SQL >> Database >  >> NoSQL >> MongoDB

Eseguire un Comando di Ricerca Testuale dal Driver Java

Tratto da un post sul gruppo Google (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); 

Questo mostra il formato esatto del comando: il nome del comando è la chiave text con la collezione come valore, e search trasporta la stringa di query.