Skip to content

Feature request: mongomock compatibility #40

@vegard

Description

@vegard

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions