Skip to content

Commit

Permalink
mipselect filter is an or between mipid and cdmip files
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristian Goina committed May 13, 2024
1 parent 59553fd commit a1020c2
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.mongodb.client.MongoDatabase;
import com.mongodb.client.model.Aggregates;
import com.mongodb.client.model.BulkWriteOptions;
import com.mongodb.client.model.Filters;
import com.mongodb.client.model.FindOneAndUpdateOptions;
import com.mongodb.client.model.Indexes;
import com.mongodb.client.model.Projections;
Expand Down Expand Up @@ -94,17 +95,19 @@ private N findAndUpdate(N neuron) {
} else {
selectFilters.add(MongoDaoHelper.createFilterById(neuron.getEntityId()));
}
List<Bson> mipSelectFilter = new ArrayList<>();
if (neuron.hasMipID()) {
selectFilters.add(MongoDaoHelper.createEqFilter("mipId", neuron.getMipId()));
mipSelectFilter.add(MongoDaoHelper.createEqFilter("mipId", neuron.getMipId()));
}
selectFilters.add(MongoDaoHelper.createEqFilter(
"computeFiles.InputColorDepthImage",
neuron.getComputeFileName(ComputeFileType.InputColorDepthImage))
);
selectFilters.add(MongoDaoHelper.createEqFilter(
"computeFiles.SourceColorDepthImage",
neuron.getComputeFileName(ComputeFileType.SourceColorDepthImage))
);
mipSelectFilter.add(Filters.and(
MongoDaoHelper.createEqFilter(
"computeFiles.InputColorDepthImage",
neuron.getComputeFileName(ComputeFileType.InputColorDepthImage)),
MongoDaoHelper.createEqFilter(
"computeFiles.SourceColorDepthImage",
neuron.getComputeFileName(ComputeFileType.SourceColorDepthImage))
));
selectFilters.add(Filters.or(mipSelectFilter));
neuron.updateableFieldValues().forEach((f) -> {
if (!f.isToBeAppended()) {
updates.add(MongoDaoHelper.getFieldUpdate(f.getFieldName(), new SetFieldValueHandler<>(f.getValue())));
Expand Down

0 comments on commit a1020c2

Please sign in to comment.