Menu

Weeks 16 & 17: MongoDB and Building a Tech Opportunity Tracker API
📰

Weeks 16 & 17: MongoDB and Building a Tech Opportunity Tracker API

DEV Community·Precious Afolabi·7 months ago
#cWM4oj2n
#mongodb#node#api#mongoose#documents
Reading 0:00
15s threshold

MongoDB and Building Real APIs

Weeks 16 and 17 covered MongoDB operations and the development of a complete API from scratch.

MongoDB CRUD Operations

Creating Documents

insertOne creates a single document. insertMany creates multiple at once. MongoDB generates a unique _id for each document automatically.

Documents are flexible. They can have different fields even in the same collection. No fixed schema unless you enforce one with Mongoose.

Reading Documents

find returns all matching documents. findOne returns the first match. Query operators filter results.

Comparison operators: $gt for greater than, $lt for less than, $gte and $lte for greater-than-or-equal-to and less-than-or-equal-to ranges. $in for matching any value in an array. $ne for not equal.

Logical operators: $and and $or combine conditions. Pattern matching with regular expressions.

Projection selects which fields to return. Limit and skip enable pagination.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.