'.dao.DataIntegrityViolationException: Cannot change the size of a document in a capped collection: 311 != 333;
using the above code I have created capped collection for my document , while I am doing insert i am facing .dao.DataIntegrityViolationException: Cannot change the size of a document in a capped collection: 311 != 333; How to resolve this
if I manually run db.runCommand( { convertToCapped: 'xx', size: 22193792 } ) in robo3t it working . if I do programmatically then only i got this error
Map<String, Object> commandArguments = new BasicDBObject();
commandArguments.put(CONVERT_TO_CAPPED,COLLECTION_NAME);
commandArguments.put(SIZE, 2147483648l);
BasicDBObject command = new BasicDBObject(commandArguments);
Document commandResult = database.runCommand(command);}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|