mongolite
Lite mongodb engine in python
pip install pymongolite
Examples
simple
from pymongolite import MongoClient
with MongoClient(dirpath="~/my_db_dir", database="my_db") as client:
db = client.get_default_database()
collection = db.get_collection("users")
collection.insert_one({"name": "yoyo"})
collection.update_one({"name": "yoyo"}, {"$set": {"age": 20}})
user = collection.find_one({"age": 20})
print(user) # -> {"_id": ObjectId(...), "name": "yoyo", "age": 20}
from pymongolite import MongoClient
client = MongoClient(dirpath="~/my_db_dir", database="my_db")
db = client.get_default_database()
collection = db.get_collection("users")
collection.insert_one({"name": "yoyo"})
collection.update_one({"name": "yoyo"}, {"$set": {"age": 20}})
user = collection.find_one({"age": 20})
print(user) # -> {"_id": ObjectId(...), "name": "yoyo", "age": 20}
client.close()
Indexes
from pymongolite import MongoClient
client = MongoClient(dirpath="~/my_db_dir", database="my_db")
db = client.get_default_database()
collection = db.get_collection("users")
# Make query with name faster
collection.create_index({"name": 1})
collection.insert_one({"name": "yoyo"})
collection.update_one({"name": "yoyo"}, {"$set": {"age": 20}})
user = collection.find_one({"age": 20})
print(user) # -> {"_id": ObjectId(...), "name": "yoyo", "age": 20}
indexes = collection.get_indexes()
print(indexes) # -> [{'id': UUID('8bb4cac8-ae52-4fff-9e69-9f36a99956cd'), 'field': 'age', 'type': 1, 'size': 1}]
client.close()
Support
The goal of this project is to create sqlite version for mongodb
For now the library is supporting:
actions:
- database
- create_database
- get_database
- drop_database
- collection
- create_collection
- get_collection
- drop_collection
- get_collection_names
- index
- create_index
- delete_index
- get_indexes
- document
- insert_many / insert_one
- update_many / update_one
- find / find_one
- replace_many / replace_one
filtering ops:
- field matching
- $eq / $ne
- $gt / $gte
- $lt / $lte
- $not
- $and / $or / $nor
- $exists
- $in / $nin
mutation ops:
- $set
- $unset
- $inc
- $addToSet
- $each
- $push
- $each
- $sort
- $slice
- $pull
Metadata
Release files for pymongolite 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pymongolite-0.1.7.tar.gz | 16.8 kB | Without provenance | Details for pymongolite-0.1.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pymongolite-0.1.7-py3-none-any.whl | Python 3 | none | any | Details for pymongolite-0.1.7-py3-none-any.whl |
Total release size: 41.9 kB
Release files / pymongolite-0.1.7.tar.gz
| Download URL | pymongolite-0.1.7.tar.gz |
|---|---|
| Size | 16.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2cdee4d9d361c633a357d44162be298f25e9e66443571810600611b82ad216d3
|
|
BLAKE2b-256 checksum How to use checksums |
bb0fd2c403248fd557a6a5d9b0df5e253bc8f82a5a723256b238580a1fa79e43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.10.12 Linux/6.5.0-28-generic
|
Release files / pymongolite-0.1.7-py3-none-any.whl
| Download URL | pymongolite-0.1.7-py3-none-any.whl |
|---|---|
| Size | 25.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9eb4ce95f5a64da351c40dc054e8107bbb0468b472f5c312b5d14cee3f3e3bd3
|
|
BLAKE2b-256 checksum How to use checksums |
ffcd63feb330612eff634b3a3469fa63fe7f82940aff1f20b55bbd668cadf4ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.12 CPython/3.10.12 Linux/6.5.0-28-generic
|
Security for pymongolite 0.1.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.