Hice un equipo por usuarios (ID de usuario), ahora quiero buscar si ese usuario está presente en el equipo o no.
exports.start = async (message) => { const check = await group.find({userID1:message.author.id} ||{userID2:message.author.id} || {userID3:message.author.id}) console.log(check); }Mi base de datos se ve así
{ "_id" : ObjectId("6173107fcf643f15e1fced83"), "userID1" : "769819933390667796", "userName1" : "Davion", "userID2" : "247276609894219777", "userName2" : "Davion", "userID3" : "898413310872006716", "userName3" : "Davion", "team" : "3", "__v" : 0 }$o como lógico o operador
exports.start = async (message) => { const check = await group.find({ $and: [ { $or: [ { userID1: message.author.id }, { userID2: message.author.id }, { userID3: message.author.id } ] } ] }) console.log(check); }$and realiza una operación AND lógica en una matriz de una o más expresiones (expresión1, expresión2, etc.) y selecciona los documentos que satisfacen todas las expresiones.
exports.start = async (message) => { const check = await group.find({ $and: [ { userID1: message.author.id }, { userID2: message.author.id }, { userID3: message.author.id } ] }) console.log(check); }