zoukankan      html  css  js  c++  java
  • mongodb(2) -索引创建

    在shell中查看集合中已经存在的索引,你可以运行:

    db.things.getIndexes()

    要查看数据库中所有的索引,可以运行:

    db.system.indexes.find()

    创建索引
    db.things.ensureIndex({j:1});


    建选项

    ensureIndex函数的第二个参数是携带创建选项的文档/对象。这些选项有:

    选项 默认值
    background true/false false
    dropDups true/false false
    unique true/false false
    sparse true/false false
    v 索引版本。0=早于v2.0版本,1=更小/更快(当前) 1 in v2.0.除非特殊情境,默认使用1

    http://blog.csdn.net/xinghebuluo/article/details/7221639

    http://www.cnblogs.com/stephen-liu74/archive/2012/08/01/2561557.html

  • 相关阅读:
    Codeforces 977F
    Codeforces 219C
    Codeforces 1132
    Codeforces 660C
    Codeforces 603A
    Codeforces 777C
    Codeforces 677
    JNUOJ 1032
    Codeforces 677D
    Codeforces 835C
  • 原文地址:https://www.cnblogs.com/itxuexiwang/p/6857739.html
Copyright © 2011-2022 走看看