Skip to content

Commit

Permalink
Merge pull request #790 from jpars/issue-788
Browse files Browse the repository at this point in the history
#788 Explicitly set name for MongoDB snapshot commit property index
  • Loading branch information
bartoszwalacik committed Feb 19, 2019
2 parents b02ce60 + 8a50386 commit ed127d0
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -3,6 +3,7 @@
import com.mongodb.BasicDBObject;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import com.mongodb.client.model.IndexOptions;
import org.bson.Document;
import org.javers.repository.mongo.model.MongoHeadId;
import org.slf4j.Logger;
Expand All @@ -21,6 +22,7 @@ class MongoSchemaManager {
static final String COMMIT_DATE_INSTANT = "commitMetadata.commitDateInstant";
static final String COMMIT_AUTHOR = "commitMetadata.author";
static final String COMMIT_PROPERTIES = "commitMetadata.properties";
static final String COMMIT_PROPERTIES_INDEX_NAME = "commitMetadata.properties_key_value";
static final String GLOBAL_ID_KEY = "globalId_key";
static final String GLOBAL_ID_ENTITY = "globalId.entity";
static final String GLOBAL_ID_OWNER_ID_ENTITY = "globalId.ownerId.entity";
Expand All @@ -47,7 +49,8 @@ public void ensureSchema() {
snapshots.createIndex(new BasicDBObject(GLOBAL_ID_ENTITY, ASC));
snapshots.createIndex(new BasicDBObject(GLOBAL_ID_OWNER_ID_ENTITY, ASC));
snapshots.createIndex(new BasicDBObject(CHANGED_PROPERTIES, ASC));
snapshots.createIndex(new BasicDBObject(COMMIT_PROPERTIES + ".key", ASC).append(COMMIT_PROPERTIES + ".value", ASC));
snapshots.createIndex(new BasicDBObject(COMMIT_PROPERTIES + ".key", ASC).append(COMMIT_PROPERTIES + ".value", ASC),
new IndexOptions().name(COMMIT_PROPERTIES_INDEX_NAME));

headCollection();

Expand Down

0 comments on commit ed127d0

Please sign in to comment.