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

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

  •  
  •   checgg · Mar 23, 2018 · 4612 views
    This topic created in 3167 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
    checgg
    OP
    Mar 23, 2018
    1
    已解决,没好好看文档。打扰了各位。

    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   ·   Privacy   ·   Solana   ·   1140 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 17:56 · PVG 01:56 · LAX 09:56 · JFK 12:56
    ♥ Do have faith in what you're doing.