Python bson.min_key() Examples

The following are 2 code examples of bson.min_key(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module bson , or try the search function .
Example #1
Source File: json_util.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def _parse_canonical_minkey(doc):
    """Decode a JSON MinKey to bson.min_key.MinKey."""
    if doc['$minKey'] is not 1:
        raise TypeError('$minKey value must be 1: %s' % (doc,))
    if len(doc) != 1:
        raise TypeError('Bad $minKey, extra field(s): %s' % (doc,))
    return MinKey() 
Example #2
Source File: json_util.py    From learn_python3_spider with MIT License 5 votes vote down vote up
def _parse_canonical_minkey(doc):
    """Decode a JSON MinKey to bson.min_key.MinKey."""
    if doc['$minKey'] is not 1:
        raise TypeError('$minKey value must be 1: %s' % (doc,))
    if len(doc) != 1:
        raise TypeError('Bad $minKey, extra field(s): %s' % (doc,))
    return MinKey()