-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.10.1
-
Component/s: Authentication
-
Labels:None
-
Environment:Client on Windows and Server on Linux, Database is 2.4.8.
When i run use DBCollection.ensureIndex() option it is creating Index without any issue but this method is depreciated and it is suggested to use createIndex method. Using createIndex is throwing the following Exception.
I am trying to create TTL Collection using following DBObjects.
BasicDBObject ttlIndexObj=new BasicDBObject("actionDate", 1); BasicDBObject ttlIndexObjOption=new BasicDBObject("name", "actionDate_ttl_7_days").append("expireAfterSeconds", 204800); com.mongodb.MongoException: not authorized to create index on at com.mongodb.CommandResult.getException(CommandResult.java:100) at com.mongodb.CommandResult.throwOnError(CommandResult.java:134) at com.mongodb.DBTCPConnector._checkWriteError(DBTCPConnector.java:142) at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:183) at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:155) at com.mongodb.DBApiLayer$MyCollection.insert(DBApiLayer.java:270) at com.mongodb.DBApiLayer$MyCollection.createIndex(DBApiLayer.java:365) at com.mongodb.DBCollection.createIndex(DBCollection.java:484) at com.fitch.financial_statement_api.dao.NicknameChangeLogDAOTest.tesTTLIndex(NicknameChangeLogDAOTest.java:88)