Skip to content

Commit

Permalink
add updateIndex logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiangs18 committed Jan 16, 2024
1 parent 13d112f commit bf725ce
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,10 @@ public void indexesConfig() {
@Test
public void indexesConfigApp() {
final Set<Document> indexes = new HashSet<>();
db.getCollection("config_app").listIndexes().forEach((Consumer<Document>) indexes::add);
// db.getCollection("config_app").listIndexes().forEach((Consumer<Document>) indexes::add);
// indexes.forEach(doc -> doc.remove("ns"));
// indexes.forEach(this::updateInt2Long);
updateIndexes("config_app", indexes);
display(indexes);
final Set<Document> expected = set(
// new Document("v", indexVer)
Expand Down Expand Up @@ -418,6 +419,13 @@ public void indexesTestUsers() {
)));
}

public void updateIndexes(final String name, final Set<Document> indexes) {
for (Document index: db.getCollection(name).listIndexes()) {
index.remove("ns");
indexes.add(index);
}
}

public void updateInt2Long(final Document doc) {
for (Map.Entry<String, Object> entry : doc.entrySet()) {
String key = entry.getKey();
Expand Down

0 comments on commit bf725ce

Please sign in to comment.