How to create root level _id as UUID inside a trigger function

I need to create a log entry in another collection on the negative outcome of a trigger function. The new document needs to have a root _id field as a UUID not ObjectId, I’ve tried using the global BSON module, but it does not seem to have the UUID method.

Also have tried setting it manually with the base64 data, this works for other fields in the document, but not the _id field. for eg:

_id: {
        $binary: {
            base64: base64var,
            subType: "04"
        }
    }

Any advice on the above? Thanks

Im running into the same issue. I cannot create UUID fields in Functions