python mongoengine doc

Solutions on MaxInterview for python mongoengine doc by the best coders in the world

showing results for - "python mongoengine doc"
Federica
19 Feb 2018
1# Only find users whose age is 18 or less
2young_users = Users.objects(age__lte=18)
3equal_18 = Users.objects(age__not__ne=18)
4
5"""
6# Only find users whose age is 18 or less
7young_users = Users.objects(age__lte=18)
8
9Available operators are as follows:
10
11    ne – not equal to
12    lt – less than
13    lte – less than or equal to
14    gt – greater than
15    gte – greater than or equal to
16    not – negate a standard check, may be used before other operators (e.g. Q(age__not__mod=(5, 0)))
17    in – value is in list (a list of values should be provided)
18    nin – value is not in list (a list of values should be provided)
19    mod – value % x == y, where x and y are two provided values
20    all – every item in list of values provided is in array
21    size – the size of the array is
22    exists – value for field exists
23"""
24