Skip to main content

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.4.1.tar.gz (27.4 kB view details)

Uploaded Source

Built Distribution

superduper_mongodb-0.4.1-py3-none-any.whl (28.3 kB view details)

Uploaded Python 3

File details

Details for the file superduper_mongodb-0.4.1.tar.gz.

File metadata

  • Download URL: superduper_mongodb-0.4.1.tar.gz
  • Upload date:
  • Size: 27.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for superduper_mongodb-0.4.1.tar.gz
Algorithm Hash digest
SHA256 f04255c92153db37cffb60cb5b4389bb96c3f43b53bee70b37f368f68b2f27ea
MD5 f6af3dbb051479e9c1817d7388789c71
BLAKE2b-256 29f11fdcf78687cc52bbb1319e55f66642366896d2a37d71862e21cccf3e28d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for superduper_mongodb-0.4.1.tar.gz:

Publisher: release_plugins.yaml on superduper-io/superduper

Attestations:

File details

Details for the file superduper_mongodb-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for superduper_mongodb-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fa296f648d4e35ec3304aee1dd7758008218c75d32ae51365f753d7aebc7cad9
MD5 2a85818e1f9e419c4afe384c0eb2a5ab
BLAKE2b-256 95a529650949a5644ad61f3f97bfeb0c83b6c1abef64f3069c80ae88fd9cee59

See more details on using hashes here.

Provenance

The following attestation bundles were made for superduper_mongodb-0.4.1-py3-none-any.whl:

Publisher: release_plugins.yaml on superduper-io/superduper

Attestations:

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