最近几年来,地理信息系统无论是在理论上还是应用上都处在一个飞速发展的阶段。 GIS被应用于多个领域的建模和决策支持,如城市管理、区划、环境整治等等,地理信息成为信息时代重要的组成部分之一; “数字地球”概念的提出,更进一步推动了作为其技术支撑的GIS的发展。 与此同时,一些学者致力于相关的理论研究,如空间感知、空间数据误差、空间关系的形式化等等。 这恰好说明了地理信息系统作为应用技术和学科的两个方面,并且这两个方面构成了相互促进的发展过程。
To use mongodb in php, you must use mongodb’s php driver.
For the installation of MongoDB PHP on each platform and the download of the driver package, please see: PHP安装MongoDB扩展驱动
If you are using PHP7, please see: PHP7 MongoDB 安装与使用 . To ensure a correct connection, you need to specify the database name. If the database does not exist in mongoDB, mongoDB will automatically create it. The code snippet is as follows: The code snippet to create the collection is as follows: Execute the above procedure, and the output is as follows: Use in mongoDB Insert the document code snippet as follows: Execute the above procedure, and the output is as follows: Then we use the db.runoob.find (). Pretty (); command on the mongo client to view the data: Use The code snippet that reads the usage document is as follows: Execute the above procedure, and the output is as follows: Use The following example updates the document titled ‘MongoDB tutorial’ with the following code snippet: Execute the above procedure, and the output is as follows: Then we use it on the mongo client Use In the following example, we will remove a data record where ‘title’ is the MongoDB tutorial’. The code snippet is as follows: 除了以上实例外,在php中你还可以使用 For more methods of operation, refer to the Mongodb core class: http://php.net/manual/zh/mongo.core.php . 3.29.1. Make sure you connect and select a database ¶
test; // 获取名称为 "test" 的数据库 ?>
Create a collection ¶
test; // 获取名称为 "test" 的数据库 $collection = $db->createCollection("runoob"); echo "集合创建成功"; ?> 集合创建成功 Insert document ¶
insert() Method to insert the document:test; // 选择一个数据库 $collection = $db->runoob; // 选择集合 $document = array( "title" => "MongoDB", "description" => "database", "likes" => 100, "url" => "http://www.runoob.com/mongodb/", "by", "菜鸟教程" ); $collection->insert($document); echo "数据插入成功"; ?>
数据插入成功 Find a document ¶
find() Method to read the documents in the collection.test; // 选择一个数据库 $collection = $db->runoob; // 选择集合 $cursor = $collection->find(); // 迭代显示文档标题 foreach ($cursor as $document) { echo $document["title"] . "\n"; } ?> MongoDB Update document ¶
update() Method to update the document. test; // 选择一个数据库 $collection = $db->runoob; // 选择集合 // 更新文档 $collection->update(array("title"=>"MongoDB"), array('$set'=>array("title"=>"MongoDB 教程"))); // 显示更新后的文档 $cursor = $collection->find(); // 循环显示文档标题 foreach ($cursor as $document) { echo $document["title"] . "\n"; } ?> MongoDB 教程
db.runoob.find().pretty() ; command to view data:
Delete document ¶
remove() Method to delete the document. test; // 选择一个数据库 $collection = $db->runoob; // 选择集合 // 移除文档 $collection->remove(array("title"=>"MongoDB 教程"), array("justOne" => true)); // 显示可用文档数据 $cursor = $collection->find(); foreach ($cursor as $document) { echo $document["title"] . "\n"; } ?> findOne() , save() , limit() , skip() , sort() 等方法来操作Mongodb数据库。