Great points by Asya.
Also take a look at this post by Maxime talking about incompatibilities between MongoDB and Cosmos DB at the API level - Not able to restore indexes using mongorestore - #2 by MaBeuLux88
The current Cosmos DB API for MongoDB is lagging a whole version behind latest MongoDB 5.0
MongoDB Atlas is an excellent service that helps you run cloud-agnostic workloads in addition to offering latest MongoDB version since it’s all built by the same team.
Thanks,
Mahi