Quantcast
Viewing latest article 1
Browse Latest Browse All 2

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 condition will work


Viewing latest article 1
Browse Latest Browse All 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>