PHP MongoDB-创建索引(create index)
程序员文章站
2022-07-09 09:35:00
...
1、php-mongodb代码建索引(createIndexes):
<?php
$manager = new \MongoDB\Driver\Manager("mongodb://admin:[email protected]:27017");
$command = new MongoDB\Driver\Command([
"createIndexes" => "collectionName",
"indexes" => [[
"name" => "indexName",
"key" => [ "keyName" => 1],
"ns" => "databaseName.collectionName",
]],
]);
$result = $manager->executeCommand("databaseName", $command);
?>
2、php-mongodb代码删除集合(drop):
<?php
$manager = new \MongoDB\Driver\Manager("mongodb://admin:[email protected]:27017");
$command = new MongoDB\Driver\Command([
"drop" => "collectionName",
]);
$result = $manager->executeCommand("databaseName", $command);
?>
3、php-mongodb代码创建集合(create):
<?php
$manager = new \MongoDB\Driver\Manager("mongodb://admin:[email protected]:27017");
$command = new MongoDB\Driver\Command([
"create" => "collectionName",
]);
$result = $manager->executeCommand("databaseName", $command);
?>
上一篇: lucene分词
下一篇: lucene Analyzer 分词 一
推荐阅读
-
MySQL 创建索引(Create Index)的方法和语法结构及例子
-
MySQL里Create Index 能否创建主键 Primary Key
-
SQL Server 创建索引(index)
-
【ES】索引创建,为“非查询字段”不建索引 index store
-
Elasticsearch索引(index)、映射(mapping)等相关的创建
-
ElasticSearch创建索引(index)和添加映射(mapping)
-
【Elasticsearch】之 创建索引(Index)
-
java 基于lucene 如何创建index【索引】
-
PHP MongoDB-创建索引(create index)
-
数据库优化-索引的创建-MySQL-index-SQL优化-避免全表扫描