As a web developer, I have had the pleasure of working with MongoDB on several projects. My first introduction to the database came from the curriculum at Codesmith, where I learned about NoSQL databases in a lecture. Since then, I have used MongoDB in multiple Codesmith projects, including my solo project, Chalkboard.

One of the most convenient ways to work with MongoDB for me has been through the Mongoose ORM. This Object-Document Mapper provides a simple and elegant way to interact with MongoDB, allowing me to easily define schemas and perform CRUD operations. Additionally, I've found the Compass tool to be very helpful in visualizing my data and performing queries.

However, I have had to work with the MongoDB shell, called mongosh, to solve some issues and perform more advanced tasks. This required a bit more effort, but it allowed me to gain a deeper understanding of the database and how it works under the hood.

I've also had the experience of setting up MongoDB databases both locally and in Atlas, the cloud-based version of MongoDB. Both methods have their advantages and disadvantages, but I've found that using Atlas makes it easier to scale and manage my databases.

One of the biggest challenges I faced while working with MongoDB was figuring out how to work with Mongoose, specifically Mixed data types and how to update them. For the canvas components in Chalkboard, since each component may have different data properties, the Mixed schema type was the right choice, but I struggled at first figuring out how to update the data. By default, Mongoose does not know that any nested properties in a Mixed schema have updated, so you have to tell it with `$set`. However, since I did not know which properties had changed, I had to call `$set` on every nested property, and was trying to do this recursively. With the help of ChatGPT and the Mongoose documentation, I figured out that there was actually a `.set()` function on the model that just overwrites all of the data.

canvas.title = saveData.title;
canvas.set({ components: saveData.components });
canvas.updatedAt = new Date();

await canvas.save({});

MongoDB has been a powerful and flexible tool for me as a developer. Its document-based structure and the ability to work with it through Mongoose make it a great choice for web applications that require a high level of scalability and performance. With the help of Compass and the MongoDB shell, I've been able to easily manage and query my data. Overall, my experience with MongoDB has been positive, and I would recommend it to other developers looking for a solid and reliable NoSQL database.