Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

MongeezDao: add support for MongoDB 2.4 #25

Merged
merged 1 commit into from

3 participants

@davidmc24

MongoDB used to support treating arbitrary values in an index definition as "include this field in the index".
As of 2.4, it no longer does. We were using this (albeit unintentionally) in our indexes for changeset executions.
This change makes it so that the indexes can be correctly created on MongoDB 2.4.
It also drops any of the old no-longer-supported indexes so that they stop producing warning messages.

http://docs.mongodb.org/manual/release-notes/2.4-index-types/

David M. Carr MongeezDao: add support for MongoDB 2.4
MongoDB used to support treating arbitrary values in an index definition as "include this field in the index".
As of 2.4, it no longer does.  We were using this (albeit unintentionally) in our indexes for changeset executions.
This change makes it so that the indexes can be correctly created on MongoDB 2.4.
It also drops any of the old no-longer-supported indexes so that they stop producing warning messages.

http://docs.mongodb.org/manual/release-notes/2.4-index-types/
77f199b
@epishkin epishkin merged commit 219b7a5 into from
@izmailoff

0.9.3-SNAPSHOT does not declare commons-lang3 as a transitive dependency, and commons-lang was used previously instead. Just wonder if it's by intention.
Thanks ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 20, 2013
  1. MongeezDao: add support for MongoDB 2.4

    David M. Carr authored
    MongoDB used to support treating arbitrary values in an index definition as "include this field in the index".
    As of 2.4, it no longer does.  We were using this (albeit unintentionally) in our indexes for changeset executions.
    This change makes it so that the indexes can be correctly created on MongoDB 2.4.
    It also drops any of the old no-longer-supported indexes so that they stop producing warning messages.
    
    http://docs.mongodb.org/manual/release-notes/2.4-index-types/
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 1 deletion.
  1. +15 −1 src/main/java/org/mongeez/dao/MongeezDao.java
View
16 src/main/java/org/mongeez/dao/MongeezDao.java
@@ -46,6 +46,7 @@ public MongeezDao(Mongo mongo, String databaseName, MongoAuth auth) {
private void configure() {
addTypeToUntypedRecords();
loadConfigurationRecord();
+ dropObsoleteChangeSetExecutionIndices();
ensureChangeSetExecutionIndex();
}
@@ -84,9 +85,22 @@ private void loadConfigurationRecord() {
}
}
+ /**
+ * Removes indices that were generated by versions before 0.9.3, since they're not supported by MongoDB 2.4+
+ */
+ private void dropObsoleteChangeSetExecutionIndices() {
+ String indexName = "type_changeSetExecution_file_1_changeId_1_author_1_resourcePath_1";
+ DBCollection collection = getMongeezCollection();
+ for (DBObject dbObject : collection.getIndexInfo()) {
+ if (indexName.equals(dbObject.get("name"))) {
+ collection.dropIndex(indexName);
+ }
+ }
+ }
+
private void ensureChangeSetExecutionIndex() {
BasicDBObject keys = new BasicDBObject();
- keys.append("type", RecordType.changeSetExecution.name());
+ keys.append("type", 1);
for (ChangeSetAttribute attribute : changeSetAttributes) {
keys.append(attribute.name(), 1);
}
Something went wrong with that request. Please try again.