zoukankan      html  css  js  c++  java
  • MongoDB(三) 常用操作

    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" })
    
  • 相关阅读:
    IOC
    软件问题
    POJO和JavaBean
    tail命令
    实现质数遍历并输出所需时间
    完数
    break、continue
    *各种形状
    for、while、do-while
    jenkins实现maven项目自动化部署tomcat
  • 原文地址:https://www.cnblogs.com/bermaker/p/8848667.html
Copyright © 2011-2022 走看看