Tora
DIAdiscord.js - Imagine an app
•Created by Tora on 4/8/2024 in #djs-questions
Logic confusion when querying data with mongodb
Hello, good morning, I have a problem and I don't know if the query is being performed correctly and this is the query code:
const matchingMethods = await PrecioXP.find({
skill: skill,
$or: [
{ $and: [{ startlevel: { $lte: minLevel } }, { endlevel: { $gte: minLevel } }] },
{ $and: [{ startlevel: { $lte: maxLevel } }, { endlevel: { $gte: maxLevel } }] },
{ $and: [{ startlevel: { $gte: minLevel } }, { endlevel: { $lte: maxLevel } }] }
]
}).sort({ method: 1 });
4 replies