0
Well I need to do a search on a collection
where I have XI, XF, YI e YF
I will send for example x:10, y:9
so I need to identify which location items satisfy that location.
Given the items saved in the bank:
[{
XI: 1,
XF: 5,
YI: 5,
YF: 20
},
{
XI: 6,
XF: 11,
YI: 21,
YF: 36
},
{
XI: 16,
XF: 21,
YI: 37,
YF: 52
},
{
XI: 22,
XF: 27,
YI: 53,
YF: 68
},
{
XI: 28,
XF: 33,
YI: 69,
YF: 84
},
{
XI: 34,
XF: 39,
YI: 85,
YF: 100
}]
I tried to do it this way:
locais.find({
$and: [
{
XI: { $gte: 10 },
},
{
XF: { $lte: 10 },
},
{
YI: { $gte: 12 },
},
{
YF: { $lte: 12 },
},
]
}).then((teste) => {
console.log(teste)
});
});
But so he’s going to the bank and taking the bank’s values that he’s the number that I told him about.