Quantcast
Channel: Node, Mongoose - $or operator not functioning as expected - Stack Overflow
Browsing latest articles
Browse All 2 View Live

Answer by mickl for Node, Mongoose - $or operator not functioning as expected

awaited .find() method returns an empty array which is truthy in JavaScript, try:console.log(![])You can use .findOne() instead and in that case null will be returned when there's no match and your...

View Article


Node, Mongoose - $or operator not functioning as expected

Within my express app, I have a mongoose schema like so:User model schema:const userSchema = new mongoose.Schema({ username: { type: String, required: true, unique: true, minlength: 4, maxlength: 50 },...

View Article
Browsing latest articles
Browse All 2 View Live