Lesson 19 of 22 · NoSQL

Finding Documents

Query a document database: find documents in a collection with MongoDB-style filters.

Data is stored as documents (JSON objects) in collections.

Basic Operations

db.collection.find({})              // Find all
db.collection.find({ key: val })    // Find with filter
db.collection.insertOne({ ... })    // Insert a document

The sample users collection has fields like name, role, age, isActive and city.

Your challenge

Find every user whose role is "admin".

Solve it in your browser

Free, no sign-up. The NoSQL database runs in your browser; your answer is checked instantly, with hints if you need them. Plus a 1-question quiz.