I need to filter the collection by the following condition: the minimum value of two fields in each document must be less than 0.1
.
Example:
fdrp_bh_ref | fdrp_bh_alt |
---|---|
0.01 | 1.0 |
1.0 | 0.01 |
0.6 | 0.8 |
Expected result:
fdrp_bh_ref | fdrp_bh_alt |
---|---|
0.01 | 1.0 |
1.0 | 0.01 |
This is done very easily in Python
:
two_dim = [[0.01, 1.0], [1.0, 0.01], [0.6, 0.8]]
print(list(filter(lambda row: min(row) < 0.1, two_dim)))
[[0.01, 1.0], [1.0, 0.01]]
Is it possible to do it in MongoDB
?