I need to mock a MongoDB database for unit testing. Is there a straightforward way to mock a DB to do so?
Use a local mongod instance, it’s pretty lightweight. You can use something like mtools (GitHub - rueckstiess/mtools: A collection of scripts to set up MongoDB test environments and parse and visualize MongoDB log files.) to spin up and shutdown a variety of different deployment options (standalone, replica set, sharded cluster etc).
Thanks a lot Peter that’s very helpful. Is there something similar that you know of for Go?