From fe6a00390dffe841dceba1b60ede04740c058093 Mon Sep 17 00:00:00 2001 From: Cristian Goina Date: Tue, 2 Apr 2024 10:23:48 -0400 Subject: [PATCH] do not use client session anymore for findOneAndUpdate --- .../colormipsearch/dao/mongo/NeuronMetadataMongoDao.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/colormipsearch-persist/src/main/java/org/janelia/colormipsearch/dao/mongo/NeuronMetadataMongoDao.java b/colormipsearch-persist/src/main/java/org/janelia/colormipsearch/dao/mongo/NeuronMetadataMongoDao.java index 87bec022..bfbc14af 100644 --- a/colormipsearch-persist/src/main/java/org/janelia/colormipsearch/dao/mongo/NeuronMetadataMongoDao.java +++ b/colormipsearch-persist/src/main/java/org/janelia/colormipsearch/dao/mongo/NeuronMetadataMongoDao.java @@ -13,12 +13,10 @@ import java.util.stream.Stream; import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; import com.mongodb.ReadConcern; import com.mongodb.ReadPreference; import com.mongodb.WriteConcern; import com.mongodb.bulk.BulkWriteResult; -import com.mongodb.client.ClientSession; import com.mongodb.client.MongoClient; import com.mongodb.client.MongoDatabase; import com.mongodb.client.model.Aggregates; @@ -55,12 +53,9 @@ public class NeuronMetadataMongoDao extends Abst implements NeuronMetadataDao { private static final int MAX_UPDATE_RETRIES = 3; - private final ClientSession session; - public NeuronMetadataMongoDao(MongoClient mongoClient, MongoDatabase mongoDatabase, IdGenerator idGenerator) { super(mongoClient, mongoDatabase, idGenerator); createDocumentIndexes(); - session = mongoClient.startSession(); } @Override @@ -128,7 +123,6 @@ private N findAndUpdate(N neuron) { .withWriteConcern(WriteConcern.MAJORITY) .withReadPreference(ReadPreference.primaryPreferred()) .findOneAndUpdate( - session, MongoDaoHelper.createBsonFilterCriteria(selectFilters), MongoDaoHelper.combineUpdates(updates), updateOptions