PHP Mongodb创建文本索引

时间:2015-08-14 20:53:26

标签: php mongodb indexing

我是MongoDB的新手,我正在尝试创建文本索引。 几个小时后,我还没有完成任何事情。

我有//The keys and values are reversed to avoid duplicates in the array keys. $arr = array( 'Personal' => array( 'PEPE' => "_id", 'd' => array( "full_name" => "Pedro", "last_name" => "Picapiedras", "address"=> "La matanza 123", "department"=> "Soporte" ), //d end 'PABLO' => "_id", 'd' => array( "full_name"=> "Pablo", "last_name"=> "Marmolejo", "address"=> "Pica 123", "department"=> "Soporte" ), //d end )//personal end );//arr end 这样:

_id

我想创建一个db.reviews.createIndex( { comments: "text" } ) 字段的索引,以便编辑或查看文档,通过" Pablo"或者" Pepe"。

这可能吗?你能告诉我如何做到这一点吗?

修改

我试过

$user = Array(
        '_id'  => "$id",
        'name' => $name,
    ); 
   $query = Array( '_id' => "$id" );
   $query = Array( '_id' => new MongoId("$id") );

var someVariable = something;
someFunction(someVariable); // <--- this is the function call

0 个答案:

没有答案