Class MongoDBIndexCreator
- java.lang.Object
-
- org.nuxeo.ecm.core.storage.mongodb.MongoDBIndexCreator
-
public class MongoDBIndexCreator extends Object
- Since:
- 2021.8
-
-
Field Summary
Fields Modifier and Type Field Description protected com.mongodb.client.MongoCollection<org.bson.Document>
collection
protected Map<String,org.bson.Document>
existingIndexes
protected PropertyCharacteristicHandler
handler
-
Constructor Summary
Constructors Constructor Description MongoDBIndexCreator(PropertyCharacteristicHandler handler, com.mongodb.client.MongoCollection<org.bson.Document> collection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
checkDefinition(boolean expectedValue, org.bson.Document actualIndex, String fieldName)
protected boolean
checkDefinition(Object expectedValue, org.bson.Document actualIndex, String fieldName)
protected boolean
checkDefinition(org.bson.conversions.Bson expectedValue, org.bson.Document actualIndex, String fieldName)
void
createIndexes(List<com.mongodb.client.model.IndexModel> indexes)
void
createIndexes(Schema schema)
protected Map<String,org.bson.Document>
getExistingIndexes()
protected String
getIndexName(com.mongodb.client.model.IndexModel index)
protected boolean
hasCorrectDefinition(com.mongodb.client.model.IndexModel index, org.bson.Document actualIndex)
protected String
pathToIndexKey(String path)
Converts the given Nuxeopath
to MongoDB identifier.protected com.mongodb.client.model.IndexModel
toIndexModel(PropertyIndexOrder property)
-
-
-
Field Detail
-
handler
protected final PropertyCharacteristicHandler handler
-
collection
protected final com.mongodb.client.MongoCollection<org.bson.Document> collection
-
-
Constructor Detail
-
MongoDBIndexCreator
public MongoDBIndexCreator(PropertyCharacteristicHandler handler, com.mongodb.client.MongoCollection<org.bson.Document> collection)
-
-
Method Detail
-
createIndexes
public void createIndexes(Schema schema)
-
createIndexes
public void createIndexes(List<com.mongodb.client.model.IndexModel> indexes)
-
pathToIndexKey
protected String pathToIndexKey(String path)
Converts the given Nuxeopath
to MongoDB identifier.For example:
- dc:title -> dc:title
- file:content/data -> file:content.data
- files:files/*/data -> files:files.data
-
toIndexModel
protected com.mongodb.client.model.IndexModel toIndexModel(PropertyIndexOrder property)
-
getIndexName
protected String getIndexName(com.mongodb.client.model.IndexModel index)
-
hasCorrectDefinition
protected boolean hasCorrectDefinition(com.mongodb.client.model.IndexModel index, org.bson.Document actualIndex)
-
checkDefinition
protected boolean checkDefinition(boolean expectedValue, org.bson.Document actualIndex, String fieldName)
-
checkDefinition
protected boolean checkDefinition(Object expectedValue, org.bson.Document actualIndex, String fieldName)
-
checkDefinition
protected boolean checkDefinition(org.bson.conversions.Bson expectedValue, org.bson.Document actualIndex, String fieldName)
-
-