MongoServerError: Unable to read from a snapshot due to pending collection catalog changes; please retry the operation.

from a bit search, I came to know you need to have collections created before using transactions

so I have created collection before using transaction like below, even the we got the same error.

if (!haveModel) {
await mongoose.connection.db.createCollection(“test_collection”);
}

const result = await TestModel.create([flow], { session });

any help would be appreciated.