推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
Livid
408.15D
537.09D
V2EX  ›  Python

PyMODM

  •  
  •   Livid ·
    PRO
    · Sep 11, 2017 · 6220 views
    This topic created in 3365 days ago, the information mentioned may be changed or developed.
    一个由 MongoDB 官方开发者维护的 MongoDB Python ORM 库:

    https://pypi.python.org/pypi/pymodm
    15 replies  •  2017-09-11 22:00:29 +08:00
    chaleaoch
    chaleaoch
    Sep 11, 2017
    1
    沙发,是 orm 库吗?还是类似 pymysql 的这种。
    Sanko
    Sanko
    Sep 11, 2017 via Android
    2
    和 django 一样,赞
    Itanium
    Itanium
    Sep 11, 2017
    3
    应该说是 ODM
    polaris1119
    polaris1119
    Sep 11, 2017
    4
    @chaleaoch 写的很清楚 MongoDB Python ORM 库
    dcalsky
    dcalsky
    Sep 11, 2017
    5
    又多了一条裤子
    CoderGeek
    CoderGeek
    Sep 11, 2017
    6
    可以~
    yanzixuan
    yanzixuan
    Sep 11, 2017
    7
    虽然不是 ORM,但是其他的 mongo model lib 可以创建关系的。比如 mongoengine, 有 ReferenceField。
    不知道这个可不可以,看了下,没有能添加关系的例子。
    yanzixuan
    yanzixuan
    Sep 11, 2017❤️1
    8
    我在这里找到了添加关联关系的例子 http://docs.mongoengine.org/tutorial.html#defining-our-documents:

    from pymodm import EmbeddedMongoModel, MongoModel, fields

    class Comment(EmbeddedMongoModel):
    author = fields.ReferenceField(User)
    content = fields.CharField()

    class Post(MongoModel):
    title = fields.CharField()
    author = fields.ReferenceField(User)
    revised_on = fields.DateTimeField()
    content = fields.CharField()
    comments = fields.EmbeddedDocumentListField(Comment)
    doubleflower
    doubleflower
    Sep 11, 2017
    9
    @yanzixuan 你什么眼神
    qsnow6
    qsnow6
    Sep 11, 2017
    10
    1 楼和 7 楼厉害的
    wellsc
    wellsc
    Sep 11, 2017 via iPhone
    11
    用法和 mongoengine hin 类似
    janxin
    janxin
    Sep 11, 2017 via iPhone
    12
    在用一个轻量级的 umongo
    tonghuashuai
    tonghuashuai
    Sep 11, 2017
    13
    用法类似 mongoengine,但是貌似对多个库的支持不好,现在一直在用 mongokit
    janxin
    janxin
    Sep 11, 2017 via iPhone
    14
    @tonghuashuai 这个库不是好久没更新了吗
    tonghuashuai
    tonghuashuai
    Sep 11, 2017
    15
    @janxin 对,是好久没更新了,新版本的 pymongo 都不能兼容,估计再往后用风险就比较大了……
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2138 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 44ms · UTC 03:37 · PVG 11:37 · LAX 19:37 · JFK 22:37
    ♥ Do have faith in what you're doing.