Skip to content

Commit 0218f40

Browse files
committed
lib: ignore the query parameter apiKey when building the BSON object for ontology queries, #TASK-5571
1 parent 01d147a commit 0218f40

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

cellbase-lib/src/main/java/org/opencb/cellbase/lib/impl/core/OntologyMongoDBAdaptor.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ public CellBaseIterator<OntologyTerm> iterator(OntologyQuery query) throws CellB
6464
QueryOptions queryOptions = query.toQueryOptions();
6565

6666
MongoDBCollection mongoDBCollection = getCollectionByRelease(mongoDBCollectionByRelease, query.getDataRelease());
67+
System.out.println("ontology mongodb adaptor: mongoDBCollection = " + mongoDBCollection.toString() + ", data release = "
68+
+ query.getDataRelease());
6769
MongoDBIterator<OntologyTerm> iterator = mongoDBCollection.iterator(null, bson, projection, CONVERTER, queryOptions);
6870
return new CellBaseMongoDBIterator<>(iterator);
6971
}
@@ -114,9 +116,15 @@ public Bson parseQuery(OntologyQuery query) {
114116
try {
115117
for (Map.Entry<String, Object> entry : query.toObjectMap().entrySet()) {
116118
String dotNotationName = entry.getKey();
117-
if (!"dataRelease".equals(dotNotationName)) {
118-
Object value = entry.getValue();
119-
createAndOrQuery(value, dotNotationName, QueryParam.Type.STRING, andBsonList);
119+
switch (dotNotationName) {
120+
case "dataRelease":
121+
case "apiKey":
122+
// Nothing to do
123+
break;
124+
default: {
125+
Object value = entry.getValue();
126+
createAndOrQuery(value, dotNotationName, QueryParam.Type.STRING, andBsonList);
127+
}
120128
}
121129
}
122130
} catch (IllegalAccessException e) {

0 commit comments

Comments
 (0)