Skip to main content

MongoNow is the equivalent of sqlite for MongoDB. It's a local in-memory mongo-like database.

Project description

Are you unsatisfied of working with mock data in dev environment ?

MongoNow is here to help.

Do you wonder if there is a quick way of setting up a dummy MongoDB instance in less that seconds?

With MongoNow, all your problems have finally found a solution. Install MongoNow with pip or git and your Mongo-like database is ready to be used in seconds.

Installation

Install the MongoNow package with python-pip or clone it from github.

Install using pip:

$ pip install mongonow

Install using git:

$ git clone https://github.com/AlexandreMahdhaoui/MongoNow.git

Usage:

  • Create a MongoNowClient instance and start exploring its content:
from mongonow import MongoNowClient

# Create a MongoNowClient specifying the path of your databases.
client = MongoNowClient(path='/dbs')
# Select one of your database
db = client['test_db']
# Select a collection
cheese_collection = db['cheese']
  • Perform a query on your collection with the same syntax you would use for MongoDB:
# SELECT all FROM cheese documents WHERE price is less than 4.99 AND country is France
>>> cheese_collection.find({
....    '$and': [
....        {'$lt': {'price': '4.99'}},
....        {'$eq': {'country': 'France'}} # or {'country: 'France'} without $eq
....    ]
.... })

Iterator([
    {
        "_id": 5590198231212309,
        "name": "Camembert",
        "price": 2.99,
        "country": "France"
    },    
    {
        "_id": 5512398091283234,
        "name": "Maroilles",
        "price": 4.49,
        "country": "France"
    }
])
  • Mutate several documents
# Set field discounted to True for all french cheese
cheese_collection.update_many(
    {"country": "France"},
    {"discounted": True}
)

File Structure

The structure of the local database should be conform to the MongoNow's file structure Specification.

  • The Database Container (e.g. dbs/) containing all databases. The path of this folder has to be specified during MongoNowClient instanciation: client = MongoNowClient(path='/dbs')
  • Database folders (e.g. test_db/) containing all its collection. Navigate to this database with db = client['test_db'].
  • Collection files (e.g. cheese.json): Navigate to this collection with coll = db['cheese'].
...
└── dbs/
    ├── dev_db/
    │   └── ...
    └── test_db/
        ├── users.json
        │   └── ...
        └── cheese.json
            └── {
                  "cheese": [
                    {
                      "_id": 5590198231212309,
                      "name": "Camembert",
                      "price": 2.99,
                      "country": "France"
                    },
                    {
                      "_id": 5512398091283234,
                      "name": "Maroilles",
                      "price": 4.49,
                      "country": "France"
                    }
                  ]
                }

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mongonow-0.0.16.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

mongonow-0.0.16-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file mongonow-0.0.16.tar.gz.

File metadata

  • Download URL: mongonow-0.0.16.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.6

File hashes

Hashes for mongonow-0.0.16.tar.gz
Algorithm Hash digest
SHA256 d05229edcc2c9f874ffda56dbb6ea01bc6cb16e2b370ae53cccd25bd3692183e
MD5 b128f7d663b8b8f2e4a47cac1b8712ca
BLAKE2b-256 18197abe3dd24500ed04d9222f881cbf0c1887837525a5564d510e0c6f4f4bf7

See more details on using hashes here.

File details

Details for the file mongonow-0.0.16-py3-none-any.whl.

File metadata

  • Download URL: mongonow-0.0.16-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.6

File hashes

Hashes for mongonow-0.0.16-py3-none-any.whl
Algorithm Hash digest
SHA256 c1cc460d861bb698c97db0cc4fb734d0a5769efeed6aef6dd4edec5d37402814
MD5 7f2849e57e8e6005545ac2624497de6a
BLAKE2b-256 2d9b85b37975bf29384f13d1901dab980cd1d0544a1f8b127d240b2a30eb4628

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page