List of usage examples for com.mongodb MongoCommandException getErrorCode
public int getErrorCode()
From source file:com.exorath.service.connector.service.MongoDatabaseProvider.java
License:Apache License
public MongoDatabaseProvider(MongoClient client, String databaseName, String collectionName) { morphia.map(Server.class); datastore = (AdvancedDatastore) morphia.createDatastore(client, databaseName); this.collectionName = collectionName; try {//from www . ja v a2 s. c om client.getDatabase(databaseName).createCollection(collectionName); } catch (MongoCommandException e) { if (e.getErrorCode() != 48) throw e; } }
From source file:org.eclipse.ditto.services.utils.persistence.mongo.indices.IndexOperations.java
License:Open Source License
private static boolean isIndexNotFound(final MongoCommandException e) { return e.getErrorCode() == 27; }
From source file:org.eclipse.ditto.services.utils.persistence.mongo.streaming.MongoTimestampPersistence.java
License:Open Source License
private static boolean isCollectionAlreadyExistsError(final MongoCommandException error) { return error.getErrorCode() == COLLECTION_ALREADY_EXISTS_ERROR_CODE; }