python类DocumentTooLarge()的实例源码

db.py 文件源码 项目:tweegraph 作者: PGryllos 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def store_timeline(db_name, user_id, timeline):
    """stores the timeline as a list of json formated statuses in
    db -> db_name[user_id] under the key 'content'

    db_name  : name of the database
    user_id  : twitter id of user
    timeline : user timeline entity as returned by the twitter api
    """
    db_client = MongoClient()
    timeline = [status._json for status in timeline]

    if timeline:
        while True:
            try:
                db_client[db_name][str(user_id)].insert_one(
                        {'_id': user_id, 'content': timeline})
                break
            except DocumentTooLargeError as e:
                timeline = timeline[:-1]
            except WriteError as e:
                timeline = timeline[:-1]
message.py 文件源码 项目:mongodb-monitoring 作者: jruaux 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def _raise_document_too_large(operation, doc_size, max_size):
    """Internal helper for raising DocumentTooLarge."""
    if operation == "insert":
        raise DocumentTooLarge("BSON document too large (%d bytes)"
                               " - the connected server supports"
                               " BSON document sizes up to %d"
                               " bytes." % (doc_size, max_size))
    else:
        # There's nothing intelligent we can say
        # about size for update and remove
        raise DocumentTooLarge("command document too large")
message.py 文件源码 项目:covar_me_app 作者: CovarMe 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def _raise_document_too_large(operation, doc_size, max_size):
    """Internal helper for raising DocumentTooLarge."""
    if operation == "insert":
        raise DocumentTooLarge("BSON document too large (%d bytes)"
                               " - the connected server supports"
                               " BSON document sizes up to %d"
                               " bytes." % (doc_size, max_size))
    else:
        # There's nothing intelligent we can say
        # about size for update and remove
        raise DocumentTooLarge("command document too large")
message.py 文件源码 项目:kekescan 作者: xiaoxiaoleo 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def _raise_document_too_large(operation, doc_size, max_size):
    """Internal helper for raising DocumentTooLarge."""
    if operation == "insert":
        raise DocumentTooLarge("BSON document too large (%d bytes)"
                               " - the connected server supports"
                               " BSON document sizes up to %d"
                               " bytes." % (doc_size, max_size))
    else:
        # There's nothing intelligent we can say
        # about size for update and remove
        raise DocumentTooLarge("command document too large")
message.py 文件源码 项目:flask-zhenai-mongo-echarts 作者: Fretice 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def _raise_document_too_large(operation, doc_size, max_size):
    """Internal helper for raising DocumentTooLarge."""
    if operation == "insert":
        raise DocumentTooLarge("BSON document too large (%d bytes)"
                               " - the connected server supports"
                               " BSON document sizes up to %d"
                               " bytes." % (doc_size, max_size))
    else:
        # There's nothing intelligent we can say
        # about size for update and remove
        raise DocumentTooLarge("command document too large")
message.py 文件源码 项目:Data-visualization 作者: insta-code1 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def _raise_document_too_large(operation, doc_size, max_size):
    """Internal helper for raising DocumentTooLarge."""
    if operation == "insert":
        raise DocumentTooLarge("BSON document too large (%d bytes)"
                               " - the connected server supports"
                               " BSON document sizes up to %d"
                               " bytes." % (doc_size, max_size))
    else:
        # There's nothing intelligent we can say
        # about size for update and remove
        raise DocumentTooLarge("command document too large")
message.py 文件源码 项目:hudl-bugbounty 作者: lewislabs 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def _raise_document_too_large(operation, doc_size, max_size):
    """Internal helper for raising DocumentTooLarge."""
    if operation == "insert":
        raise DocumentTooLarge("BSON document too large (%d bytes)"
                               " - the connected server supports"
                               " BSON document sizes up to %d"
                               " bytes." % (doc_size, max_size))
    else:
        # There's nothing intelligent we can say
        # about size for update and remove
        raise DocumentTooLarge("command document too large")
message.py 文件源码 项目:hudl-bugbounty 作者: lewislabs 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def _raise_document_too_large(operation, doc_size, max_size):
    """Internal helper for raising DocumentTooLarge."""
    if operation == "insert":
        raise DocumentTooLarge("BSON document too large (%d bytes)"
                               " - the connected server supports"
                               " BSON document sizes up to %d"
                               " bytes." % (doc_size, max_size))
    else:
        # There's nothing intelligent we can say
        # about size for update and remove
        raise DocumentTooLarge("command document too large")


问题


面经


文章

微信
公众号

扫码关注公众号