1
我在MongoDB中是新的,而我試圖創建一個文本索引。 嘗試幾個小時後,我沒有做任何事情。PHP MongoDB的創建文本索引
我有一個array
這樣的:
//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" })
和
$user = Array(
'_id' => "$id",
'name' => $name,
);
$query = Array('_id' => "$id");
$query = Array('_id' => new MongoId("$id"));
你嘗試過這麼遠嗎?如果你有代碼片段,它可以讓人們更容易地幫助你。 – khuderm