Skip to content

Commit

Permalink
do not use client session anymore for findOneAndUpdate
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristian Goina committed Apr 2, 2024
1 parent 462df69 commit fe6a003
Showing 1 changed file with 0 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -55,12 +53,9 @@ public class NeuronMetadataMongoDao<N extends AbstractNeuronEntity> extends Abst
implements NeuronMetadataDao<N> {
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
Expand Down Expand Up @@ -128,7 +123,6 @@ private N findAndUpdate(N neuron) {
.withWriteConcern(WriteConcern.MAJORITY)
.withReadPreference(ReadPreference.primaryPreferred())
.findOneAndUpdate(
session,
MongoDaoHelper.createBsonFilterCriteria(selectFilters),
MongoDaoHelper.combineUpdates(updates),
updateOptions
Expand Down

0 comments on commit fe6a003

Please sign in to comment.