HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
typegoose
mongodb-memory-server
TypeScript2021–2021
typegoose / mongodb-memory-server

mongodb-memory-server

Manage & spin up mongodb server binaries with zero(or slight) configuration for tests.

2Distinct people
2Mentions
0Explicit recommenders
2.9KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Manage & spin up mongodb server binaries with zero(or slight) configuration for tests.

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 12:54:37 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by 6-hour interval2 dated mentions

Observed mentions: 2021-04-20 22:54:26 UTC to 2021-04-27 07:27:48 UTC.

012021-04-20 18:00:00 UTC to 2021-04-21 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsApr 20, 18:002021-04-21 00:00:00 UTC to 2021-04-21 06:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-04-21 06:00:00 UTC to 2021-04-21 12:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-04-21 12:00:00 UTC to 2021-04-21 18:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-04-21 18:00:00 UTC to 2021-04-22 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-04-22 00:00:00 UTC to 2021-04-22 06:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-04-22 06:00:00 UTC to 2021-04-22 12:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-04-22 12:00:00 UTC to 2021-04-22 18:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-04-22 18:00:00 UTC to 2021-04-23 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-04-23 00:00:00 UTC to 2021-04-23 06:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-04-23 06:00:00 UTC to 2021-04-23 12:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-04-23 12:00:00 UTC to 2021-04-23 18:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-04-23 18:00:00 UTC to 2021-04-24 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-04-24 00:00:00 UTC to 2021-04-24 06:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 commentsApr 24, 00:002021-04-24 06:00:00 UTC to 2021-04-24 12:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-04-24 12:00:00 UTC to 2021-04-24 18:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-04-24 18:00:00 UTC to 2021-04-25 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-04-25 00:00:00 UTC to 2021-04-25 06:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-04-25 06:00:00 UTC to 2021-04-25 12:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-04-25 12:00:00 UTC to 2021-04-25 18:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-04-25 18:00:00 UTC to 2021-04-26 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-04-26 00:00:00 UTC to 2021-04-26 06:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-04-26 06:00:00 UTC to 2021-04-26 12:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-04-26 12:00:00 UTC to 2021-04-26 18:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-04-26 18:00:00 UTC to 2021-04-27 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-04-27 00:00:00 UTC to 2021-04-27 06:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-04-27 06:00:00 UTC to 2021-04-27 12:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 commentsApr 27, 06:00

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
Apr 20, 18:002021-04-20 18:00:00 UTC2021-04-21 00:00:00 UTC101
Apr 21, 00:002021-04-21 00:00:00 UTC2021-04-21 06:00:00 UTC000
Apr 21, 06:002021-04-21 06:00:00 UTC2021-04-21 12:00:00 UTC000
Apr 21, 12:002021-04-21 12:00:00 UTC2021-04-21 18:00:00 UTC000
Apr 21, 18:002021-04-21 18:00:00 UTC2021-04-22 00:00:00 UTC000
Apr 22, 00:002021-04-22 00:00:00 UTC2021-04-22 06:00:00 UTC000
Apr 22, 06:002021-04-22 06:00:00 UTC2021-04-22 12:00:00 UTC000
Apr 22, 12:002021-04-22 12:00:00 UTC2021-04-22 18:00:00 UTC000
Apr 22, 18:002021-04-22 18:00:00 UTC2021-04-23 00:00:00 UTC000
Apr 23, 00:002021-04-23 00:00:00 UTC2021-04-23 06:00:00 UTC000
Apr 23, 06:002021-04-23 06:00:00 UTC2021-04-23 12:00:00 UTC000
Apr 23, 12:002021-04-23 12:00:00 UTC2021-04-23 18:00:00 UTC000
Apr 23, 18:002021-04-23 18:00:00 UTC2021-04-24 00:00:00 UTC000
Apr 24, 00:002021-04-24 00:00:00 UTC2021-04-24 06:00:00 UTC000
Apr 24, 06:002021-04-24 06:00:00 UTC2021-04-24 12:00:00 UTC000
Apr 24, 12:002021-04-24 12:00:00 UTC2021-04-24 18:00:00 UTC000
Apr 24, 18:002021-04-24 18:00:00 UTC2021-04-25 00:00:00 UTC000
Apr 25, 00:002021-04-25 00:00:00 UTC2021-04-25 06:00:00 UTC000
Apr 25, 06:002021-04-25 06:00:00 UTC2021-04-25 12:00:00 UTC000
Apr 25, 12:002021-04-25 12:00:00 UTC2021-04-25 18:00:00 UTC000
Apr 25, 18:002021-04-25 18:00:00 UTC2021-04-26 00:00:00 UTC000
Apr 26, 00:002021-04-26 00:00:00 UTC2021-04-26 06:00:00 UTC000
Apr 26, 06:002021-04-26 06:00:00 UTC2021-04-26 12:00:00 UTC000
Apr 26, 12:002021-04-26 12:00:00 UTC2021-04-26 18:00:00 UTC000
Apr 26, 18:002021-04-26 18:00:00 UTC2021-04-27 00:00:00 UTC000
Apr 27, 00:002021-04-27 00:00:00 UTC2021-04-27 06:00:00 UTC000
Apr 27, 06:002021-04-27 06:00:00 UTC2021-04-27 12:00:00 UTC101

What Hacker News says

2 sources
Just want to make sure, but it seems like I can sum up your reasons for mocking are: - spinning up the service is hard - startup times can be inconsistent I may have not read deep enough but I don't see much explanation around the "I need A to behave like X" -- could you give a more concrete example? Lets say you had two queue implementations and one used Redis and one used RabbitMQ (i.e `GenericQueue<Redis|Rabbit>`), it seems ridiculous to need one of them to act like the other -- I'd love an example if you have one in mind. Optimizing spinning up the service and making startup times consistent are basically solved in half a day of work (that pays off forever), in my experience. Here's an excerpt from a Gitlab CI config I carry around from project-to-project: e2e: stage: test only: - merge_requests services:
Read the rest
- docker:dind variables: DOCKER_HOST: tcp://docker:2376 # TLS enabled (2375 for disabled) DOCKER_TLS_CERTDIR: '/certs' DOCKER_TLS_VERIFY: 1 DOCKER_CERT_PATH: '/certs/client' script: - make ensure-images setup build - make test-e2e The "ensure-images" make target actually just runs a `docker pull` before the tests: ensure-images: $(DOCKER) pull $(DB_IMAGE):$(DB_IMAGE_TAG) $(DOCKER) pull $(MAILER_IMAGE):$(MAILER_IMAGE_TAG) $(DOCKER) pull $(STRIPE_IMAGE):$(STRIPE_IMAGE_TAG) Which actually reminds me, another cool thing you can mock if you do this -- it's not 100% parity but there's a cool stripe replacement called localstripe[0]. There are bugs/unimplemented features (expecting a random F/OSS project without a ton of members to replicate stripe's API is a lot) but it exists and isn't too hard to use, so I use it in test/local/dev environments, use stripe test API keys in staging, and the real keys in prod. Another thing worth thinking is that how you optimize each piece is different -- it's often pretty fast to make new exchanges/databases and you can even just TRUNCATE tables if you're really worried about it. Here's an example from some code I wrote: public resetForTest(): Promise<this> { if (!this.conn) { return Promise.reject(new DatabaseDisconnectedError()); } // Do not truncate if database is <production db name> // for example when process.env.USE_LOCAL_DB_FOR_TEST is set if (this.getDatabaseName() === "<production db name>") { return Promise.resolve(this); } return this.getConnection() .then(c => c.query(` TRUNCATE TABLE <some table> CASCADE; TRUNCATE TABLE <another table> CASCADE; ... more ... `)) .then(() => this); } And this pattern extends itself to anything that is testable, so I've enshrined it: export interface TestableComponent extends Component { resetForTest(): Promise<this>; } Completely separate from all this -- some of the time you can literally just.. run these dependencies in memory[1]. Doesn't get much faster than that. I haven't run into a mock that didn't take time and effort to maintain/alter whenever code or the underlying systems changed. Time spent maintaining mocks is time wasted. Anyway, I won't go as far as saying that mocks are never useful, sometimes a mock is the easiest and best way -- but I can say that I spend most of my time writing E2E tests, and I trust them a lot and they give me trust in my codebase much more than mocks or unit tests do. I barely write unit tests anymore to check edge cases, because if I really cared I'd just generate them -- and I don't really have to care because I use strong type systems where possible (Typescript for JS, I avoid PHP/Python/Ruby, Rust, Haskell). Here comes the hot-take -- unit tests (and their rise in popularity/necessity) is actually a direct reflection of the adoption of non-compile-time-type-checked dynamically interpreted languages, and burdensome class-based "type systems". Correct usage of good, expressive and concise (where possible) type systems encourages you to make invalid/nonsensical states impossible, and people got excited about how fast you could churn out code (compared to Java most things feel pretty productive) and they started having numbers where they thought they had strings, and negative numbers where they thought they had natural numbers. Good type systems make it easy to make these cases impossible. As for the business stuff (never store decimals for currency, make sure your amounts are natural numbers, etc), you have to learn that with time/intuition built over time -- you don't know to write that unit test unless it's bit you before (though sitting down to write unit tests might tease it out of you). I write unit tests as regression tests basically now, but I find I rarely have to do that, since most of the time when a weird case has gone through it's an indicator that I was too lose with the types. [0]: https://github.com/adrienverge/localstripe [1]: https://github.com/nodkz/mongodb-memory-server
In Pg_tmp – Run tests on an isolated, temporary PostgreSQL database

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.