Filters
Filter system, use to filter results
Property
Description
Type usage
Teacher.find({
age: {
$gte: 20
},
score: {
$gte: 5
}
})Output
Reference with filter
Full example
Last updated
Filter system, use to filter results
Teacher.find({
age: {
$gte: 20
},
score: {
$gte: 5
}
})Last updated
[
{
_id: '628c075c147b594cc84b',
id_students: [ 123, 1234 ],
score: 10,
age: 20
},
{
_id: '628c075c147b594cc8ac0a4b',
id_students: [ 1234, 123 ],
score: 5,
age: 20
}
]Teacher.find({
age: 20,
tb_students: {
$ref: "Students",
$id: "$data.id_students",
age: { $gte: 6, $lte: 10 }
}
})Teacher.find({
$limit: 2,
score: {
$gte: 5
},
tb_students: {
$ref: "Students",
$id: "$data.id_students",
age: { $gte: 6, $lte: 10 }
}
});