推荐学习书目
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
278.36D
567.77D
V2EX  ›  Python

PyMODM

  •  
  •   Livid ·
    PRO
    · Sep 11, 2017 · 5714 views
    This topic created in 3173 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
        1
    chaleaoch  
       Sep 11, 2017
    沙发,是 orm 库吗?还是类似 pymysql 的这种。
    Sanko
        2
    Sanko  
       Sep 11, 2017 via Android
    和 django 一样,赞
    Itanium
        3
    Itanium  
       Sep 11, 2017
    应该说是 ODM
    polaris1119
        4
    polaris1119  
       Sep 11, 2017
    @chaleaoch 写的很清楚 MongoDB Python ORM 库
    dcalsky
        5
    dcalsky  
       Sep 11, 2017
    又多了一条裤子
    CoderGeek
        6
    CoderGeek  
       Sep 11, 2017
    可以~
    yanzixuan
        7
    yanzixuan  
       Sep 11, 2017
    虽然不是 ORM,但是其他的 mongo model lib 可以创建关系的。比如 mongoengine, 有 ReferenceField。
    不知道这个可不可以,看了下,没有能添加关系的例子。
    yanzixuan
        8
    yanzixuan  
       Sep 11, 2017   ❤️ 1
    我在这里找到了添加关联关系的例子 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
        9
    doubleflower  
       Sep 11, 2017
    @yanzixuan 你什么眼神
    qsnow6
        10
    qsnow6  
       Sep 11, 2017
    1 楼和 7 楼厉害的
    wellsc
        11
    wellsc  
       Sep 11, 2017 via iPhone
    用法和 mongoengine hin 类似
    janxin
        12
    janxin  
       Sep 11, 2017 via iPhone
    在用一个轻量级的 umongo
    tonghuashuai
        13
    tonghuashuai  
       Sep 11, 2017
    用法类似 mongoengine,但是貌似对多个库的支持不好,现在一直在用 mongokit
    janxin
        14
    janxin  
       Sep 11, 2017 via iPhone
    @tonghuashuai 这个库不是好久没更新了吗
    tonghuashuai
        15
    tonghuashuai  
       Sep 11, 2017
    @janxin 对,是好久没更新了,新版本的 pymongo 都不能兼容,估计再往后用风险就比较大了……
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1050 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 50ms · UTC 22:33 · PVG 06:33 · LAX 15:33 · JFK 18:33
    ♥ Do have faith in what you're doing.