Bulk operations can be run “unordered” which may result in parallel op execution (doc link).
mongo.SessionContext is not safe for use in concurrent code, however (doc link).
Does this mean I should not perform unordered bulk writes within transactions? Or does the mongo driver handle this and only goroutines generated by the user are unsafe?
Gotcha, I see where this is can be inferred now under “Error Handling inside Transactions” - they mention that the bulk write fails fast even when running unordered, which suggests its a supported operation like you say:
Inside a transaction, the first error in a bulk write causes the entire bulk write to fail and aborts the transaction, even if the bulk write is unordered.