I am using mongoDB shell with version 3.0.2 I am trying to ensure uniqueness constraint over a username field in collection users.
mongoDB shell with version 3.0.2
username
users
The drop duplicates functionality on index creation is no longer supported since Mongo version 3.0. See the compatibility changes page for the 3.0 release.