MongoDB Tutorial 0/120 lessons ~6 min read Lesson 32

    Find Documents

    find() is the read primitive.

    Course progress0%
    Focus
    5 guided sections
    Practice signal
    Examples included
    Career prep
    Foundation builder

    Introduction

    find() is the read primitive. It returns a cursor; you chain modifiers like .sort(), .limit(), .skip(), .project() to refine it. Mastering find is mastering 80% of day-to-day MongoDB work.

    Understanding the topic

    • find(filter, projection) — returns cursor.
    • findOne — returns the first match (or null).
    • Cursors are lazy — nothing executes until you iterate.
    • Indexes turn O(n) scans into O(log n) lookups.

    Syntax reference

    js
    db.users.find({ city: "NYC" })
    .sort({ createdAt: -1 })
    .limit(20)
    .project({ name: 1, email: 1, _id: 0 });
    db.orders.findOne({ _id: ObjectId("...") });

    Real-world use

    Listing endpoints in every REST API map to a single find with filter + sort + limit + projection.

    Best practices

    • Always project only the fields you need.
    • Always .limit() list queries.
    Ready to mark this lesson complete?Track your journey across the entire course.