Revision 44144
Added by Alessia Bardi over 7 years ago
MongoSetCollection.java | ||
---|---|---|
88 | 88 |
public void updateCounts(final String setSpec, final String mdPrefix, final int count, final String dbName) { |
89 | 89 |
final BasicDBObject countUpdate = new BasicDBObject("$set", new BasicDBObject("count", count)); |
90 | 90 |
final Bson query = Filters.and(Filters.eq("spec", setSpec), Filters.eq("mdPrefix", mdPrefix)); |
91 |
// DBObject setCount = BasicDBObjectBuilder.start("spec", setSpec).add("mdPrefix", mdPrefix).get(); |
|
92 |
// this.getSetsCountCollection(dbName).update(setCount, new BasicDBObject("$set", new BasicDBObject("count", count)), true, false); |
|
93 | 91 |
this.getSetsCountCollection(dbName).findOneAndUpdate(query, countUpdate, new FindOneAndUpdateOptions().upsert(true)); |
94 | 92 |
} |
95 | 93 |
|
96 | 94 |
public void upsertSet(final SetInfo setInfo, final boolean fromConfiguration, final String dbName) { |
97 | 95 |
final DBObject obj = this.getObjectFromSet(setInfo); |
98 | 96 |
obj.put("fromConfiguration", fromConfiguration); |
99 |
// this.getSetsCollection(dbName).update(new BasicDBObject("spec", setInfo.getSetSpec()), obj, true, false); |
|
100 | 97 |
this.getSetsCollection(dbName).findOneAndReplace(Filters.eq("spec", setInfo.getSetSpec()), obj, new FindOneAndReplaceOptions().upsert(true)); |
101 | 98 |
} |
102 | 99 |
|
... | ... | |
141 | 138 |
this.getSetsCountCollection(dbName).deleteMany(query); |
142 | 139 |
} |
143 | 140 |
|
144 |
public void dropConfigurationSets(final String dbName) { |
|
145 |
this.getSetsCollection(dbName).deleteMany(Filters.eq("fromConfiguration", true)); |
|
146 |
} |
|
141 |
// public void dropConfigurationSets(final String dbName) {
|
|
142 |
// this.getSetsCollection(dbName).deleteMany(Filters.eq("fromConfiguration", true));
|
|
143 |
// }
|
|
147 | 144 |
|
148 | 145 |
protected List<SetInfo> findSets(final Bson query, final String dbName) { |
149 | 146 |
final FindIterable<DBObject> sets = this.getSetsCollection(dbName).find(query); |
Also available in: Unified diff
some cleanup in OAI related classes