How to access the auto increment id in the mongoose response?

Hello community,

I’m really new into mongodb. I’ve added a db trigger for auto increment. It actually looks like the following:

exports = async function(changeEvent) {
    var docId = changeEvent.fullDocument._id;
    
    const countercollection = context.services.get("Cluster0").db(changeEvent.ns.db).collection("counters");
    const testcasescollection = context.services.get("Cluster0").db(changeEvent.ns.db).collection(changeEvent.ns.coll);
    
    var counter = await countercollection.findOneAndUpdate({_id: changeEvent.ns },{ $inc: { seq_value: 1 }}, { returnNewDocument: true, upsert : true});
    
    var updateRes = await testcasescollection.updateOne({_id : docId},{ $set : {testrunId : counter.seq_value}});
    
    console.log(`Updated ${JSON.stringify(changeEvent.ns)} with counter ${counter.seq_value} result : ${JSON.stringify(updateRes)}`);
    };

I see the auto incremented id in my mongoose response, but how can I access it from code like I could with mongoose.Types.ObjectId() to get the “_id” for example?