📜  python MongoEngine doc - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:07.625000             🧑  作者: Mango

代码示例1
# Only find users whose age is 18 or less
young_users = Users.objects(age__lte=18)
equal_18 = Users.objects(age__not__ne=18)

"""
# Only find users whose age is 18 or less
young_users = Users.objects(age__lte=18)

Available operators are as follows:

    ne – not equal to
    lt – less than
    lte – less than or equal to
    gt – greater than
    gte – greater than or equal to
    not – negate a standard check, may be used before other operators (e.g. Q(age__not__mod=(5, 0)))
    in – value is in list (a list of values should be provided)
    nin – value is not in list (a list of values should be provided)
    mod – value % x == y, where x and y are two provided values
    all – every item in list of values provided is in array
    size – the size of the array is
    exists – value for field exists
"""