Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: mongomock compatibility #40

Open
vegard opened this issue Dec 30, 2016 · 1 comment
Open

Feature request: mongomock compatibility #40

vegard opened this issue Dec 30, 2016 · 1 comment

Comments

@vegard
Copy link

vegard commented Dec 30, 2016

I've just encountered minimongo and it looks really great, but I don't think it will work with e.g. mongomock out of the box. mongomock is a drop-in substitute for pymongo which doesn't use a real mongodb backend but performs operations in-memory (not necessarily efficiently) so that you don't need the hassle of setting up a real mongodb instance for unit testing.

As an example:

>>> import mongomock
>>> client = mongomock.MongoClient()
>>> client.db.collection.insert({'foo': 'bar'})
ObjectId('586651608eda9b078e37499e')
>>> list(client.db.collection.find({}))
[{'foo': 'bar', '_id': ObjectId('586651608eda9b078e37499e')}]

It would seem better if minimongo wrapped around an existing MongoDB client (which could then be either a pymongo or a mongomock client) or an existing MongoDB database (ditto).

@ramnes
Copy link

ramnes commented Jul 4, 2022

FWIW Mongo-Thingy now supports Mongomock out of the box, and I found the idea here, so thank you @vegard!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants