r/mongodb • • 15h ago

I m new to mongo db and have to upload this assignment now This assignment needs to be done in MongoDB using mongosh (MongoDB Shell) or MongoDB Compass

0 Upvotes

i want screenshots to upload Please 1. Q1

5 marks

Create the four collections (mentioned in Problem Statement) in MongoDB.\

For posts and comments, justify in one line each whether userId should be embedded (storing user details directly inside the document) or referenced (storing only the _id and looking it up separately), and implement the chosen design consistently across all four collections.\

Insert one sample document into each collection and display it with find() to confirm the structure before proceeding.

Drag & drop or click to browsePDF, ZIP, DOCX, PNG, JPG, DOC, TXT up to 25MB · max 1 fileQ2. Data Population

5 marks

Q2 Insert at least 6 users, 10 posts (across different users), 15 comments (across different posts) and 20 likes (across different posts/users), ensuring enough variety to support later aggregation (e.g., at least one user with multiple posts, at least one post with no comments).

Then perform: (a) find() with a filter (e.g., posts by one specific user), (b) updateOne() to edit a post's content, (c) deleteOne() to remove one comment, showing the collection state after each operation.

Drag & drop or click to browsePDF, DOCX, DOC, JPG, PNG, ZIP, TXT up to 25MB · max 1 file

Q3. Aggregation pipelines

5 marks

Write three aggregation pipelines using $match, $group and $sort: (a) total likes per post, sorted descending, (b) total posts per user, (c) average number of comments per post across the whole posts collection.

Use $lookup in at least one pipeline to join posts with users and display the user's name alongside their post's like count.

Drag & drop or click to browsePDF, ZIP, TXT, DOCX, PNG, DOC, JPG up to 25MB · max 1 file

4. Q4. Index

5 marks

Create a single-field index on posts.userId and a compound index on comments covering postId and createdAt.

Re-run one query from Q3 before and after creating the relevant index, and compare the output of explain("executionStats") (documents examined, execution time) for both runs.

Drag & drop or click to browsePDF, ZIP, TXT, DOCX, PNG, DOC, JPG up to 25MB · max 1 file

You can submit once. Make sure all files are added.

Submit

Give each image for each question seperate


r/mongodb • • 15h ago

i m new to mongo db and have to upload this assignment now This assignment needs to be done in MongoDB using mongosh (MongoDB Shell) or MongoDB Compass

0 Upvotes

i want screenshots to upload Please 1. Q1

5 marks

Create the four collections (mentioned in Problem Statement) in MongoDB.\

For posts and comments, justify in one line each whether userId should be embedded (storing user details directly inside the document) or referenced (storing only the _id and looking it up separately), and implement the chosen design consistently across all four collections.\

Insert one sample document into each collection and display it with find() to confirm the structure before proceeding.

Drag & drop or click to browsePDF, ZIP, DOCX, PNG, JPG, DOC, TXT up to 25MB · max 1 fileQ2. Data Population

5 marks

Q2 Insert at least 6 users, 10 posts (across different users), 15 comments (across different posts) and 20 likes (across different posts/users), ensuring enough variety to support later aggregation (e.g., at least one user with multiple posts, at least one post with no comments).

Then perform: (a) find() with a filter (e.g., posts by one specific user), (b) updateOne() to edit a post's content, (c) deleteOne() to remove one comment, showing the collection state after each operation.

Drag & drop or click to browsePDF, DOCX, DOC, JPG, PNG, ZIP, TXT up to 25MB · max 1 file

Q3. Aggregation pipelines

5 marks

Write three aggregation pipelines using $match, $group and $sort: (a) total likes per post, sorted descending, (b) total posts per user, (c) average number of comments per post across the whole posts collection.

Use $lookup in at least one pipeline to join posts with users and display the user's name alongside their post's like count.

Drag & drop or click to browsePDF, ZIP, TXT, DOCX, PNG, DOC, JPG up to 25MB · max 1 file

4. Q4. Index

5 marks

Create a single-field index on posts.userId and a compound index on comments covering postId and createdAt.

Re-run one query from Q3 before and after creating the relevant index, and compare the output of explain("executionStats") (documents examined, execution time) for both runs.

Drag & drop or click to browsePDF, ZIP, TXT, DOCX, PNG, DOC, JPG up to 25MB · max 1 file

You can submit once. Make sure all files are added.

Submit

Give each image for each question seperate


r/mongodb • • 14h ago

After months of job rejections, I spent 2 years building a MongoDB GUI. It just got added to Microsoft's Azure docs.

11 Upvotes

After struggling to land a job in 2024, when the market was pretty rough, I decided to take a different route and build something real. My goal was simple: either build something genuinely useful or gain more experience than anything else could offer.

Two years and countless 90-hour weeks later, VisuaLeaf is now featured in Microsoft's Azure DocumentDB documentation as a client for connecting to its MongoDB-compatible database service:

https://learn.microsoft.com/en-us/azure/documentdb/how-to-connect-visualeaf

It started as a MongoDB GUI, so posting this announcement really means a lot to me since this was the subreddit that started it all.

From the beginning, I wanted every part of the database workflow to feel as straightforward as possible, from exploring nested documents and building queries to database management and integrating AI. VisuaLeaf has evolved quite a bit since I first shared it here.

Today, VisuaLeaf supports MongoDB, Postgres, MySQL, SQLite, DuckDB, and 40+ more database engines.

What it does:

  • Table + tree views built for nested documents: Expand nested objects and arrays directly into columns within the table instead of having to deal with json in 1 cell, or having a separate embedded view dedicated for an array. Both views stay smooth even with massive collections.
  • Visual query builder + MongoDB shell: Build queries by clicking or dragging fields directly from the table and tree views, or write commands in the built-in MongoDB shell with real-time syntax error highlighting and intelligent autocomplete. Generated queries are readable and can be copied or executed.
  • Data transfers with transformations: Move data between databases (Postgres → MongoDB, SQLite → MongoDB, MongoDB → MongoDB), mask sensitive fields, apply custom JavaScript transformations, and enrich data with lookups from other collections.
  • Compare and sync: Compare collection structures and data, preview differences, and synchronize databases between environments, with dry-run support.
  • AI / MCP:  The MCP server is read-only by default. You can grant write access per connection, so an agent can run aggregations, data transfers, or anything else the app can do. There's also a built-in assistant for quick tasks, similar to Compass's.
  • Sharding and clusters: manage shards on any sharded cluster (shard-key advisor, chunks, zones, balancer, resharding), or deploy and run your own self-hosted replica set or sharded cluster on Docker or Kubernetes.
  • ERDs, charts, dashboards, mock data, index management, query profilers, and a lot more than I can fit into one post
  • Performance:  I've stress-tested datasets up to 1.6 GB, and the tree can expand thousands of rows at once. Existing grid libraries like AG-Grid couldn't support the nested column expansion I wanted, so I built my own grid from scratch, which took roughly a year to develop and optimize. (In my testing, VisuaLeaf also loaded data several seconds faster than nearly all MongoDB GUIs I’ve tested it against).

There's a free version that covers what most people need day to day:

https://visualeaf.com

I'd really appreciate feedback! And happy to answer any questions!

PS. VisuaLeaf is the only app that actually supports MongoDB Version 3.4 and newer versions of MongoDB in one app (from what I’ve seen).