As per MongoDB documentation, transactions only works for replica sets and not single node. Why such requirement? Isn’t it is easier to do transaction stuff on a single node rather than a distributed system?
Since transactions are built on concepts of logical sessions they require mecahnics (like oplog) which are only available in replica set environment.
You can always convert a standalone to a single noded replica set and transactions will work with this one node.