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

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

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -