最近几年来,地理信息系统无论是在理论上还是应用上都处在一个飞速发展的阶段。 GIS被应用于多个领域的建模和决策支持,如城市管理、区划、环境整治等等,地理信息成为信息时代重要的组成部分之一; “数字地球”概念的提出,更进一步推动了作为其技术支撑的GIS的发展。 与此同时,一些学者致力于相关的理论研究,如空间感知、空间数据误差、空间关系的形式化等等。 这恰好说明了地理信息系统作为应用技术和学科的两个方面,并且这两个方面构成了相互促进的发展过程。
In the previous chapters, we have learned how to add and update data for collections in MongoDB. In this section we will continue to learn about the deletion of the MongoDB collection.
MongoDB remove() Function is used to remove data from the collection.
MongoDB data updates can be updated using the If your MongoDB is later than version 2.6, the syntax format is as follows: 参数说明: query : (optional) the condition of the deleted document. justOne : (optional) if set to true or 1, only one document is deleted, and if this parameter is not set, or if the default value false is used, all documents that match the criteria are deleted. writeConcern (optional) the level at which the exception is thrown We perform two insert operations in the following documents: Use Next, let’s remove the document whose title is’ MongoDB tutorial’: If you only want to delete the first record found, you can set justOne to 1, as shown below: If you want to delete all data, you can use the following methods (similar to the regular SQL truncate command): update() Function. In execution remove() Execute the function before the function find() Command to determine whether the execution conditions are correct, which is a good habit. 3.15.1. Grammar ¶
remove() The basic syntax format of the method is as follows:db.collection.remove( <query>, <justOne> )
db.collection.remove( <query>, { justOne: <boolean>, writeConcern: <document> } )
3.15.2. Example ¶
>db.col.insert({title: 'MongoDB 教程', description: 'MongoDB 是一个 Nosql 数据库', by: '菜鸟教程', url: 'http://www.runoob.com', tags: ['mongodb', 'database', 'NoSQL'], likes: 100 })
find() Function to query data:> db.col.find() { "_id" : ObjectId("56066169ade2f21f36b03137"), "title" : "MongoDB 教程", "description" : "MongoDB 是一个 Nosql 数据库", "by" : "菜鸟教程", "url" : "http://www.runoob.com", "tags" : [ "mongodb", "database", "NoSQL" ], "likes" : 100 } { "_id" : ObjectId("5606616dade2f21f36b03138"), "title" : "MongoDB 教程", "description" : "MongoDB 是一个 Nosql 数据库", "by" : "菜鸟教程", "url" : "http://www.runoob.com", "tags" : [ "mongodb", "database", "NoSQL" ], "likes" : 100 }
>db.col.remove({'title':'MongoDB 教程'}) WriteResult({ "nRemoved" : 2 }) # 删除了两条数据 >db.col.find() …… # 没有数据 >db.COLLECTION_NAME.remove(DELETION_CRITERIA,1)
>db.col.remove({}) >db.col.find() >