V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐工具
RoboMongo
推荐书目
50 Tips and Tricks for MongoDB Developers
Related Blogs
Snail in a Turtleneck
checgg
V2EX  ›  MongoDB

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

  •  
  •   checgg · Mar 23, 2018 · 4227 views
    This topic created in 2965 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   ·   2616 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 11:07 · PVG 19:07 · LAX 04:07 · JFK 07:07
    ♥ Do have faith in what you're doing.