# Reading and Changing Data

Ask MongoDB for exactly what you need: filters with comparison operators, one document by its id, only the fields you want, sorted and a page at a time. Then change documents in place with update operators, delete them, and make searches fast with indexes and text search.

Updated: November 19, 2026

## [Finding Documents](https://www.ask-codey.com/courses/nodejs-in-depth/topics/node-mongodb-finding)

1. [Finding Documents with Filters](https://www.ask-codey.com/lessons/node-mongodb-find-and-filters) (Apprentice): A filter object tells find and findOne which documents you want, with operators such as $gte and $in for comparisons, dot notation for a field inside a field, an ObjectId to find one document by its id, and a projection to send back only the fields you need.
2. [Sorting and Paging Results](https://www.ask-codey.com/lessons/node-mongodb-sort-and-paging) (Journeyman): sort puts a query's results in order, skip and limit cut out one page of them, and countDocuments counts every match, so an API can answer with page 2 of 3 instead of every document at once.

## [Changing Documents](https://www.ask-codey.com/courses/nodejs-in-depth/topics/node-mongodb-changing)

1. [Updating and Deleting Documents](https://www.ask-codey.com/lessons/node-mongodb-update-and-delete) (Apprentice): updateOne and updateMany change documents in place with update operators such as $set, $inc, $push and $pull, their result's matchedCount and modifiedCount say what happened, findOneAndUpdate gives back the changed document, and deleteOne removes one.

## [Fast Searches](https://www.ask-codey.com/courses/nodejs-in-depth/topics/node-mongodb-indexes)

1. [Indexes and Text Search](https://www.ask-codey.com/lessons/node-mongodb-indexes-and-text-search) (Journeyman): An index lets MongoDB jump to the documents a query wants instead of reading every one, a unique index refuses a second document with the same value, and a text index lets $text search the words in a collection's text fields.

## [Exercise: Farmers Market Vendors](https://www.ask-codey.com/courses/nodejs-in-depth/topics/exercise-node-farmers-market-vendors)

1. [Exercise: Farmers Market Vendors](https://www.ask-codey.com/lessons/exercise-node-farmers-market-vendors) (Journeyman): Write the Saturday Farmers Market's vendor functions with the official driver (filters with $in and $gte, a sorted page with its total, one vendor by its id, updates with $set and $push, a delete, two indexes and a text search) and let tests on a throwaway MongoDB check every one.

Source: https://www.ask-codey.com/courses/nodejs-in-depth/chapters/node-mongodb-reading-and-changing-data
