Skip to content

Commit e34ca60

Browse files
committed
include wildcard index
1 parent 2cda286 commit e34ca60

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

src/main/java/picoded/dstack/mongodb/MongoDB_DataObjectMap.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,23 +88,22 @@ public void systemSetup() {
8888
//
8989
// We intentionally DO NOT use mongodb _id, allowing it retain optimal performance.
9090
//
91-
// Overtime, when "maintainance" is called, additional
92-
// indexes would be generated, to improve overall query peformance.
93-
//
94-
// This assumes "autoIndex" is enabled. The default behaviour is "true"
95-
//
9691
IndexOptions opt = new IndexOptions();
9792
opt = opt.unique(true);
9893
opt = opt.name("_oid");
94+
opt = opt.background(true);
9995
collection.createIndex(Indexes.ascending("_oid"), opt);
10096

10197
// Wildcard indexing
10298
//
10399
// This helps improve general performance for arbitary data
104100
// at a huge cost of write performance
105-
opt = new IndexOptions();
106-
opt = opt.name("wildcard");
107-
collection.createIndex(Indexes.ascending("$**"), opt);
101+
if (configMap.getBoolean("setupWildcardIndex", true)) {
102+
opt = new IndexOptions();
103+
opt = opt.name("wildcard");
104+
opt = opt.background(true);
105+
collection.createIndex(Indexes.ascending("$**"), opt);
106+
}
108107
}
109108

110109
/**

0 commit comments

Comments
 (0)