推荐工具
RoboMongo
推荐书目
50 Tips and Tricks for MongoDB Developers
Related Blogs
Snail in a Turtleneck
checgg
V2EX  ›  MongoDB

请教一个 mongodb 创建唯一索引的问题

  •  
  •   checgg · Mar 23, 2018 · 4269 views
    This topic created in 2988 days ago, the information mentioned may be changed or developed.

    db.collection.createIndex({name:1},{unique:true})

    name:1

    这个 1 应该如何理解?

    1 replies    2018-03-23 10:23:45 +08:00
    checgg
        1
    checgg  
    OP
       Mar 23, 2018
    已解决,没好好看文档。打扰了各位。

    The value of the field in the index specification describes the kind of index for that field. For example, a value of 1 specifies an index that orders items in ascending order. A value of -1 specifies an index that orders items in descending order. For additional index types, see index types.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1000 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 22:19 · PVG 06:19 · LAX 15:19 · JFK 18:19
    ♥ Do have faith in what you're doing.