I need to mock a MongoDB database for unit testing. Is there a straightforward way to mock a DB to do so?
Skip to main content
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?
New & Unread Topics
Topic | Replies | Views | Activity |
---|---|---|---|
Data collection sctructure schema | 1 | 297 | May 2024 |
About database Design | 1 | 265 | Jul 2024 |
Timeseries collections - increase max count of documents per bucket | 3 | 378 | Jul 2024 |
Issue with Aggregation from Two Collections in MongoDB | 3 | 56 | Oct 2024 |
Mongodb update same key in multiple collection | 2 | 27 | 12d |