MongoDB(三) 常用操作
阿新 • • 發佈:2018-04-15
auto note res for dex code pda 創建 count()
MongoDB 常用操作
# 查看索引是否存在 > db.boundary.ensureIndex({ "geometry" : "2dsphere" } ) { "createdCollectionAutomatically" : false, "numIndexesBefore" : 2, "numIndexesAfter" : 2, "note" : "all indexes already exist", "ok" : 1 } # 刪除索引 > db.boundary.dropIndex({ "geometry" : "2dsphere" }) { "nIndexesWas" : 2, "ok" : 1 } # 查詢某一字段是否存在 > db.boundary.find( { "geometry": { $exists: true } } ).count() 54 # 刪除表中的某一字段 > db.boundary.update( {}, {$unset: {"geometry":""} }, {multi: true} ) WriteResult({ "nMatched" : 1971, "nUpserted" : 0, "nModified" : 54 }) # 創建索引 db.boundary.createIndex({ "geometry": "2dsphere" })
MongoDB(三) 常用操作