Get only the FALSE value with MongoDB query

To get only the documents with FALSE values from a boolean field in MongoDB, use the find() method with a query condition that matches the false value directly or uses comparison operators.

Syntax

db.collection.find({ "fieldName": false });
// OR
db.collection.find({ "fieldName": { "$ne": true } });

Sample Data

Let us first create a collection with documents having an isEnable field with TRUE or FALSE values ?

db.translateDefinitionDemo.insertMany([
    { "_id": 10, "StudentName": "Larry", "isEnable": true },
    { "_id": 20, "StudentName": "Chris", "isEnable": false },
    { "_id": 30, "StudentName": "Robert", "isEnable": true },
    { "_id": 40, "StudentName": "Sam", "isEnable": false },
    { "_id": 50, "StudentName": "Mike", "isEnable": true }
]);
{
    "acknowledged": true,
    "insertedIds": { "0": 10, "1": 20, "2": 30, "3": 40, "4": 50 }
}

Display all documents to see the complete data ?

db.translateDefinitionDemo.find().pretty();
{ "_id": 10, "StudentName": "Larry", "isEnable": true }
{ "_id": 20, "StudentName": "Chris", "isEnable": false }
{ "_id": 30, "StudentName": "Robert", "isEnable": true }
{ "_id": 40, "StudentName": "Sam", "isEnable": false }
{ "_id": 50, "StudentName": "Mike", "isEnable": true }

Method 1: Direct FALSE Match

Query documents where isEnable is exactly false ?

db.translateDefinitionDemo.find({ "isEnable": false }).pretty();
{ "_id": 20, "StudentName": "Chris", "isEnable": false }
{ "_id": 40, "StudentName": "Sam", "isEnable": false }

Method 2: Using $ne Operator

Find documents where isEnable is not equal to true ?

db.translateDefinitionDemo.find({ "isEnable": { "$ne": true } }).pretty();
{ "_id": 20, "StudentName": "Chris", "isEnable": false }
{ "_id": 40, "StudentName": "Sam", "isEnable": false }

Key Points

  • Direct match ({ "field": false }) is simpler and more efficient for exact boolean queries.
  • $ne operator also catches null values and missing fields, not just false values.
  • Both methods return the same result when the field contains only true/false values.

Conclusion

Use { "fieldName": false } to get documents with FALSE boolean values. The $ne operator provides an alternative approach but may include documents with null or missing fields.

Updated on: 2026-03-15T00:26:11+05:30

237 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements