Data concurrency in MongoDB

Hello team,
I want to understand how to implement data concurrency in MongoDB using Nodejs and Mongoose.

Query:
I have 2 collections. In my program, I want to perform the below queries:

Step1: Fetch a key “key1” from collection-1
Step2: If “key1” is true then perform some action in collection-2
else perform some action in collection-3.

My attempted code:

const session = await mongoose.startSession();
try{
      session.startTransaction();
      let key1 = await coll1.findOne({},{key1:1}, {session}); // step1
      if(key1){
           await coll2.updateOne({}, {}, {session}); // step2
       } else {
           await coll3.updateOne({}, {}, {session}); // step2
}
await session.commitTransaction();
} catch (error) {
		await session.abortTransaction();
		throw error;
} finally {
        session.endSession();
}

I have written this code in Nodejs even using transactions. but not able to handle data concurrency properly. I have seen many wrong entries in collection-2 and collection-3.

Please share sample documents from your 3 collections.

Please share expected results for a given scenario. Share the wrong result you are getting for the same input.

Please add more details to your redacted code. Your queries are empty and ditto for your update operations. It is hard to say what you are doing wrong if you do not share what you are doing.

I do not know about mongoose, but the native updateOne returns a result. Testing returned values from an API and act accordingly is the first step to figure out what is happening.

Apologies for the confusion.
Here is the real scenario:
Consider we have two collection: post and post_likes
post: (_id, likeCount, angryCount)
post_likes: (_id, postId, userId, likeType(angry/like))

A user can only give one reaction to a post.
Now a specific user decided to change his reaction to a specific post very fast again and again, and this is the code not able to handle data concurrency. and it ruins my counts stored.

// request-paramameter: userId, postId, likeType
const addupdateLike = async () => {
    const session = await mongoose.startSession();
    try {
        session.startTransaction();
        let isLiked = await post_likes.findOne({ userId: userId, postId: postId }, {}, { session });
        if (isLiked && isLiked.likeType === likeType) {
            // do nothing
        } else if (isLiked) {

            await Promise.all([
                updateCount(isLiked.likeType, userId, postId, -1, session),
                post_likes.findOneAndUpdate({ postId, userId }, { postId, userId, likeType }, { upsert: true, session }),
                updateCount(likeType, postId, 1, session),
            ]);
        } else {
            await Promise.all([
                post_likes.findOneAndUpdate({ postId, userId }, { postId, userId, likeType }, { upsert: true, session }),
                updateCount(likeType, postId, 1, session),
            ]);
        }
        await session.commitTransaction();
    } catch (error) {
        await session.abortTransaction();
        throw error;
    } finally {
        session.endSession();
    }
}

const updateCount = async (likeType, postId, incrBy, session) => {
    let dataToUpdate = {};
    if (likeType === "angry") {
        dataToUpdate.angryCount = incrBy;
    } else {
        dataToUpdate.likeCount = incrBy;
    }
    post.updateOne({ _id: postId }, { $inc: dataToUpdate }, { session }),
}

As requested:

And also