Name | pymodm JSON |
Version |
0.4.3
JSON |
| download |
home_page | |
Summary | PyMODM is a generic ODM on top of PyMongo. |
upload_time | 2020-04-30 18:52:38 |
maintainer | |
docs_url | None |
author | Luke Lovett |
requires_python | |
license | Apache License, Version 2.0 |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
======
PyMODM
======
.. image:: https://readthedocs.org/projects/pymodm/badge/?version=stable
:alt: Documentation
:target: http://pymodm.readthedocs.io/en/stable/?badge=stable
.. image:: https://travis-ci.org/mongodb/pymodm.svg?branch=master
:alt: View build status
:target: https://travis-ci.org/mongodb/pymodm
.. image:: https://badges.gitter.im/mongodb/pymodm.svg
:alt: Join the chat at https://gitter.im/mongodb/pymodm
:target: https://gitter.im/mongodb/pymodm?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
A generic ODM around PyMongo_, the MongoDB Python driver. PyMODM works on Python
2.7 as well as Python 3.3 and up. To learn more, you can browse the `official
documentation`_ or take a look at some `examples`_.
.. _PyMongo: https://pypi.python.org/pypi/pymongo
.. _official documentation: http://pymodm.readthedocs.io/en/stable
.. _examples: https://github.com/mongodb/pymodm/tree/master/example
Why PyMODM?
===========
PyMODM is a "core" ODM, meaning that it provides simple, extensible
functionality that can be leveraged by other libraries to target platforms like
Django. At the same time, PyMODM is powerful enough to be used for developing
applications on its own. Because MongoDB engineers are involved in developing
and maintaining the project, PyMODM will also be quick to adopt new MongoDB
features.
Support / Feedback
==================
For issues with, questions about, or feedback for PyMODM, please look into
our `support channels <http://www.mongodb.org/about/support>`_. Please do not
email any of the PyMODM developers directly with issues or questions -
you're more likely to get an answer on the `MongoDB Community Forums <https://developer.mongodb.com/community/forums/tags/c/drivers-odms-connectors/7/pymodm-odm>`_.
Bugs / Feature Requests
=======================
Think you’ve found a bug? Want to see a new feature in PyMODM? Please open
a case in our issue management tool, JIRA:
- `Create an account and login <https://jira.mongodb.org>`_.
- Navigate to `the PYMODM project <https://jira.mongodb.org/browse/PYMODM>`_.
- Click **Create Issue** - Please provide as much information as possible about the issue type and how to reproduce it.
Bug reports in JIRA for all driver projects (e.g. PYMODM, PYTHON, JAVA) and the
Core Server (i.e. SERVER) project are **public**.
How To Ask For Help
-------------------
Please include all of the following information when opening an issue:
- Detailed steps to reproduce the problem, including full traceback, if possible.
- The exact python version used, with patch level::
$ python -c "import sys; print(sys.version)"
- The exact version of PyMODM used, with patch level::
$ python -c "import pymodm; print(pymodm.version)"
- The PyMongo version used, with patch level::
$ python -c "import pymongo; print(pymongo.version)"
- The operating system and version (e.g. Windows 7, OSX 10.8, ...)
- Web framework or asynchronous network library used, if any, with version (e.g.
Django 1.7, mod_wsgi 4.3.0, gevent 1.0.1, Tornado 4.0.2, ...)
Security Vulnerabilities
------------------------
If you’ve identified a security vulnerability in a driver or any other
MongoDB project, please report it according to the `instructions here
<http://docs.mongodb.org/manual/tutorial/create-a-vulnerability-report>`_.
Example
=======
Here's a basic example of how to define some models and connect them to MongoDB:
.. code-block:: python
from pymongo import TEXT
from pymongo.operations import IndexModel
from pymodm import connect, fields, MongoModel, EmbeddedMongoModel
# Connect to MongoDB first. PyMODM supports all URI options supported by
# PyMongo. Make sure also to specify a database in the connection string:
connect('mongodb://localhost:27017/myApp')
# Now let's define some Models.
class User(MongoModel):
# Use 'email' as the '_id' field in MongoDB.
email = fields.EmailField(primary_key=True)
fname = fields.CharField()
lname = fields.CharField()
class BlogPost(MongoModel):
# This field references the User model above.
# It's stored as a bson.objectid.ObjectId in MongoDB.
author = fields.ReferenceField(User)
title = fields.CharField(max_length=100)
content = fields.CharField()
tags = fields.ListField(fields.CharField(max_length=20))
# These Comment objects will be stored inside each Post document in the
# database.
comments = fields.EmbeddedDocumentListField('Comment')
class Meta:
# Text index on content can be used for text search.
indexes = [IndexModel([('content', TEXT)])]
# This is an "embedded" model and will be stored as a sub-document.
class Comment(EmbeddedMongoModel):
author = fields.ReferenceField(User)
body = fields.CharField()
vote_score = fields.IntegerField(min_value=0)
# Start the blog.
# We need to save these objects before referencing them later.
han_solo = User('mongoblogger@reallycoolmongostuff.com', 'Han', 'Solo').save()
chewbacca = User(
'someoneelse@reallycoolmongostuff.com', 'Chewbacca', 'Thomas').save()
post = BlogPost(
# Since this is a ReferenceField, we had to save han_solo first.
author=han_solo,
title="Five Crazy Health Foods Jabba Eats.",
content="...",
tags=['alien health', 'slideshow', 'jabba', 'huts'],
comments=[
Comment(author=chewbacca, body='Rrrrrrrrrrrrrrrr!', vote_score=42)
]
).save()
# Find objects using familiar MongoDB-style syntax.
slideshows = BlogPost.objects.raw({'tags': 'slideshow'})
# Only retrieve the 'title' field.
slideshow_titles = slideshows.only('title')
# u'Five Crazy Health Foods Jabba Eats.'
print(slideshow_titles.first().title)
Raw data
{
"_id": null,
"home_page": "",
"name": "pymodm",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Luke Lovett",
"author_email": "mongodb-user@googlegroups.com",
"download_url": "https://files.pythonhosted.org/packages/d0/68/d2001233b684b8d32e988188c85def43a2ef6a4b1e8b074942c0c0120aff/pymodm-0.4.3.tar.gz",
"platform": "any",
"description": "======\nPyMODM\n======\n\n\n.. image:: https://readthedocs.org/projects/pymodm/badge/?version=stable\n :alt: Documentation\n :target: http://pymodm.readthedocs.io/en/stable/?badge=stable\n\n.. image:: https://travis-ci.org/mongodb/pymodm.svg?branch=master\n :alt: View build status\n :target: https://travis-ci.org/mongodb/pymodm\n\n.. image:: https://badges.gitter.im/mongodb/pymodm.svg\n :alt: Join the chat at https://gitter.im/mongodb/pymodm\n :target: https://gitter.im/mongodb/pymodm?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge\n\nA generic ODM around PyMongo_, the MongoDB Python driver. PyMODM works on Python\n2.7 as well as Python 3.3 and up. To learn more, you can browse the `official\ndocumentation`_ or take a look at some `examples`_.\n\n.. _PyMongo: https://pypi.python.org/pypi/pymongo\n.. _official documentation: http://pymodm.readthedocs.io/en/stable\n.. _examples: https://github.com/mongodb/pymodm/tree/master/example\n\nWhy PyMODM?\n===========\n\nPyMODM is a \"core\" ODM, meaning that it provides simple, extensible\nfunctionality that can be leveraged by other libraries to target platforms like\nDjango. At the same time, PyMODM is powerful enough to be used for developing\napplications on its own. Because MongoDB engineers are involved in developing\nand maintaining the project, PyMODM will also be quick to adopt new MongoDB\nfeatures.\n\nSupport / Feedback\n==================\n\nFor issues with, questions about, or feedback for PyMODM, please look into\nour `support channels <http://www.mongodb.org/about/support>`_. Please do not\nemail any of the PyMODM developers directly with issues or questions -\nyou're more likely to get an answer on the `MongoDB Community Forums <https://developer.mongodb.com/community/forums/tags/c/drivers-odms-connectors/7/pymodm-odm>`_.\n\nBugs / Feature Requests\n=======================\n\nThink you\u2019ve found a bug? Want to see a new feature in PyMODM? Please open\na case in our issue management tool, JIRA:\n\n- `Create an account and login <https://jira.mongodb.org>`_.\n- Navigate to `the PYMODM project <https://jira.mongodb.org/browse/PYMODM>`_.\n- Click **Create Issue** - Please provide as much information as possible about the issue type and how to reproduce it.\n\nBug reports in JIRA for all driver projects (e.g. PYMODM, PYTHON, JAVA) and the\nCore Server (i.e. SERVER) project are **public**.\n\nHow To Ask For Help\n-------------------\n\nPlease include all of the following information when opening an issue:\n\n- Detailed steps to reproduce the problem, including full traceback, if possible.\n- The exact python version used, with patch level::\n\n $ python -c \"import sys; print(sys.version)\"\n\n- The exact version of PyMODM used, with patch level::\n\n $ python -c \"import pymodm; print(pymodm.version)\"\n\n- The PyMongo version used, with patch level::\n\n $ python -c \"import pymongo; print(pymongo.version)\"\n\n- The operating system and version (e.g. Windows 7, OSX 10.8, ...)\n- Web framework or asynchronous network library used, if any, with version (e.g.\n Django 1.7, mod_wsgi 4.3.0, gevent 1.0.1, Tornado 4.0.2, ...)\n\nSecurity Vulnerabilities\n------------------------\n\nIf you\u2019ve identified a security vulnerability in a driver or any other\nMongoDB project, please report it according to the `instructions here\n<http://docs.mongodb.org/manual/tutorial/create-a-vulnerability-report>`_.\n\nExample\n=======\n\nHere's a basic example of how to define some models and connect them to MongoDB:\n\n.. code-block:: python\n\n from pymongo import TEXT\n from pymongo.operations import IndexModel\n from pymodm import connect, fields, MongoModel, EmbeddedMongoModel\n\n\n # Connect to MongoDB first. PyMODM supports all URI options supported by\n # PyMongo. Make sure also to specify a database in the connection string:\n connect('mongodb://localhost:27017/myApp')\n\n\n # Now let's define some Models.\n class User(MongoModel):\n # Use 'email' as the '_id' field in MongoDB.\n email = fields.EmailField(primary_key=True)\n fname = fields.CharField()\n lname = fields.CharField()\n\n\n class BlogPost(MongoModel):\n # This field references the User model above.\n # It's stored as a bson.objectid.ObjectId in MongoDB.\n author = fields.ReferenceField(User)\n title = fields.CharField(max_length=100)\n content = fields.CharField()\n tags = fields.ListField(fields.CharField(max_length=20))\n # These Comment objects will be stored inside each Post document in the\n # database.\n comments = fields.EmbeddedDocumentListField('Comment')\n\n class Meta:\n # Text index on content can be used for text search.\n indexes = [IndexModel([('content', TEXT)])]\n\n # This is an \"embedded\" model and will be stored as a sub-document.\n class Comment(EmbeddedMongoModel):\n author = fields.ReferenceField(User)\n body = fields.CharField()\n vote_score = fields.IntegerField(min_value=0)\n\n\n # Start the blog.\n # We need to save these objects before referencing them later.\n han_solo = User('mongoblogger@reallycoolmongostuff.com', 'Han', 'Solo').save()\n chewbacca = User(\n 'someoneelse@reallycoolmongostuff.com', 'Chewbacca', 'Thomas').save()\n\n\n post = BlogPost(\n # Since this is a ReferenceField, we had to save han_solo first.\n author=han_solo,\n title=\"Five Crazy Health Foods Jabba Eats.\",\n content=\"...\",\n tags=['alien health', 'slideshow', 'jabba', 'huts'],\n comments=[\n Comment(author=chewbacca, body='Rrrrrrrrrrrrrrrr!', vote_score=42)\n ]\n ).save()\n\n\n # Find objects using familiar MongoDB-style syntax.\n slideshows = BlogPost.objects.raw({'tags': 'slideshow'})\n\n # Only retrieve the 'title' field.\n slideshow_titles = slideshows.only('title')\n\n # u'Five Crazy Health Foods Jabba Eats.'\n print(slideshow_titles.first().title)\n\n\n",
"bugtrack_url": null,
"license": "Apache License, Version 2.0",
"summary": "PyMODM is a generic ODM on top of PyMongo.",
"version": "0.4.3",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "30d226765629b9d984fc10a0f5abf2b3551c847c691d4f57b375205c06996dc4",
"md5": "cdf1a4f6214865f8aaf6012eb0b4d50f",
"sha256": "98e790bb457a7faf4e0aca71ff8a13d584eb6d9075db98202c8f1ce334675e55"
},
"downloads": -1,
"filename": "pymodm-0.4.3-py2-none-any.whl",
"has_sig": false,
"md5_digest": "cdf1a4f6214865f8aaf6012eb0b4d50f",
"packagetype": "bdist_wheel",
"python_version": "py2",
"requires_python": null,
"size": 48219,
"upload_time": "2020-04-30T18:52:35",
"upload_time_iso_8601": "2020-04-30T18:52:35.390286Z",
"url": "https://files.pythonhosted.org/packages/30/d2/26765629b9d984fc10a0f5abf2b3551c847c691d4f57b375205c06996dc4/pymodm-0.4.3-py2-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1550d250e457eeb4bd49a9a0d26bbb5918a15689dac3b5b0d594beec11e30090",
"md5": "afe2f4ed48a451b66a259dd5959dcc18",
"sha256": "697b23d93695fdbaccc995912aecb203d1f1d8f8bff7ad90a9180f6a2986d084"
},
"downloads": -1,
"filename": "pymodm-0.4.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "afe2f4ed48a451b66a259dd5959dcc18",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 48212,
"upload_time": "2020-04-30T18:52:36",
"upload_time_iso_8601": "2020-04-30T18:52:36.784996Z",
"url": "https://files.pythonhosted.org/packages/15/50/d250e457eeb4bd49a9a0d26bbb5918a15689dac3b5b0d594beec11e30090/pymodm-0.4.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d068d2001233b684b8d32e988188c85def43a2ef6a4b1e8b074942c0c0120aff",
"md5": "e30cd1871de72e00fade686cb1dcf880",
"sha256": "b9fc352dabca1c10bc9342167ab322ce2898b68a79c42e19f0baa7d5b7578ea1"
},
"downloads": -1,
"filename": "pymodm-0.4.3.tar.gz",
"has_sig": false,
"md5_digest": "e30cd1871de72e00fade686cb1dcf880",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 55402,
"upload_time": "2020-04-30T18:52:38",
"upload_time_iso_8601": "2020-04-30T18:52:38.133593Z",
"url": "https://files.pythonhosted.org/packages/d0/68/d2001233b684b8d32e988188c85def43a2ef6a4b1e8b074942c0c0120aff/pymodm-0.4.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2020-04-30 18:52:38",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "pymodm"
}