SuperDuper MongoDB is a Python library that provides a high-level API for working with MongoDB. It is built on top of pymongo and provides a more user-friendly interface for working with MongoDB.
Project description
superduper_mongodb
SuperDuper MongoDB is a Python library that provides a high-level API for working with MongoDB. It is built on top of pymongo and provides a more user-friendly interface for working with MongoDB.
In general the MongoDB query API works exactly as per pymongo, with the exception that:
- inputs are wrapped in Document
- additional support for vector-search is provided
- queries are executed lazily
Installation
pip install superduper_mongodb
API
Class | Description |
---|---|
superduper_mongodb.data_backend.MongoDataBackend |
Data backend for MongoDB. |
superduper_mongodb.metadata.MongoMetaDataStore |
Metadata store for MongoDB. |
superduper_mongodb.query.MongoQuery |
A query class for MongoDB. |
superduper_mongodb.query.BulkOp |
A bulk operation for MongoDB. |
superduper_mongodb.artifacts.MongoArtifactStore |
Artifact store for MongoDB. |
Connection examples
Connect to mongomock
from superduper import superduper
db = superduper('mongomock://test')
Connect to MongoDB
from superduper import superduper
db = superduper('mongodb://localhost:27017/documents')
Connect to MongoDB Atlas
from superduper import superduper
db = superduper('mongodb+srv://<username>:<password>@<cluster-url>/<database>')
Query examples
Inserts
db['my-collection'].insert_many([{'my-field': ..., ...}
for _ in range(20)
]).execute()
Updates
db['my-collection'].update_many(
{'<my>': '<filter>'},
{'$set': ...},
).execute()
Selects
db['my-collection'].find({}, {'_id': 1}).limit(10).execute()
Vector-search
Vector-searches may be integrated with .find
.
db['my-collection'].like({'img': <my_image>}, vector_index='my-index-name').find({}, {'img': 1}).execute()
Read more about vector-search here.
Deletes
db['my-collection'].delete_many({}).execute()
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
superduper_mongodb-0.0.5.tar.gz
(25.4 kB
view hashes)
Built Distribution
Close
Hashes for superduper_mongodb-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b9fb4ed4c976298fb79670205fe6e00481fb05429ba93beb42237682007abe8 |
|
MD5 | a5017d714494823e14c99f1987b1de89 |
|
BLAKE2b-256 | efc7792196ee50730aad4abc031c8dcebd221e2907d2623a45892c4c0b6796d5 |