'How to return all types except a certain type in MongoDB?

Let's say that there is a column called colours and it can have values red, blue, and green. I want to retrieve all rows except the ones where the colour is green. How to do this in MongoDB?



Solution 1:[1]

Hey you can use $ne operator in mongoDB for reference look here : https://www.educative.io/edpresso/what-is-the-ne-operator-in-mongodb

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 RANJAN KUMAR SINGH