mongodb creating unique index: significance of ": 1" -


following how unique constraint created in mongodb:

db.members.createindex( { "user_id": 1 }, { unique: true } ) 

what significance of "1" in above command. above command seems bit counter-intuitive me because of "1"

directly documentation:

a value of 1 specifies index orders items in ascending order. value of -1 specifies index orders items in descending order.

so creates index on user_id field in ascending order , values can unique.


Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

android - MPAndroidChart - How to add Annotations or images to the chart -