Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Access embedded documents with CRUD by id.

Project Description

mongoengine-embedded

This package provides basic CRUD methods on EmbeddedDocumentListField through _id.

Usage

import mongoengine
from mongoengine_embedded import EmbeddedResource, ResourceContainer

# embedded resource
class Masterpiece(mongoengine.EmbeddedDocument, EmbeddedResource):
    title = mongoengine.StringField()

# document contains embedded resource
@ResourceContainer
class Monkey(mongoengine.Document):
    masterpieces = mongoengine.EmbeddedDocumentListField(
        Masterpiece, element_name='masterpiece')

the_monkey = Monkey()
the_monkey.save()

# Create
one_masterpiece = the_monkey.create_masterpiece(title='Complete Works of William Shakespeare')
another_masterpiece = the_monkey.create_masterpiece(title='Siku Quanshu')

another_id = another_masterpiece.id
# Read
another = the_monkey.get_masterpiece_by_id(another_id)

# Update
the_monkey.modify_masterpiece_by_id(another_id, set__name='Jing Shi Zi Ji')

# Destroy
the_monkey.destroy_masterpiece_by_id(another_id)

Installation

This Package can be installed through pip:

pip install mongoengine-embedded

LICENSE

MIT LICENSE

Release History

Release History

This version
History Node

1.0.1

History Node

1.0.0

History Node

0.2.0

History Node

0.1.0

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
mongoengine-embedded-1.0.1.tar.gz (3.9 kB) Copy SHA256 Checksum SHA256 Source Apr 18, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting