MongoDB
 sql >> Database >  >> NoSQL >> MongoDB

Come cercare nell'indice fulltext usando php in mongodb

Questa sembra essere la risposta alla mia domanda:

<?php
$result = $db->command(
    array(
        'text' => 'bar', //this is the name of the collection where we are searching
        'search' => 'hotel', //the string to search
        'limit' => 5, //the number of results, by default is 1000
        'project' => Array( //the fields to retrieve from db
            'title' => 1
        )
    )
);

http://www.php.net/manual/en/mongodb .command.php#111891