Home / Companies / MongoDB / Blog / March 2019

March 2019 Summaries

7 posts from MongoDB

Filter
Month: Year:
Post Summaries Back to Blog
JSON schema validation is a powerful tool in MongoDB that allows developers to lock down their document data model, introducing concrete milestones and ensuring no unintended changes or unexpected data. The validation process occurs during document updates and inserts, and can be applied both during collection creation and on existing documents. By defining fields and field types, values, minimum and maximum items, and additional properties, developers can enforce strict standards on their data structure. This allows for rapid testing of different schema designs and eventual enforcement of standards, providing the benefits of flexibility and data validation in MongoDB's document model.
Mar 26, 2019 1,157 words in the original blog post.
The Tree Pattern is a schema design pattern used to represent hierarchical data in MongoDB, aiming to reduce JOIN operations by storing related data together. This approach involves representing the hierarchy as an array of "parents" for each node, which can be stored in a single field, allowing for efficient querying and updates. The pattern is particularly useful for scenarios with static or rarely changing hierarchies, such as product catalogs, where it enables fast retrieval of descendants and ancestors. While there may be a tradeoff between simplicity and performance, the Tree Pattern offers better performance by avoiding multiple JOINs, but requires careful management of updates to the graph.
Mar 21, 2019 636 words in the original blog post.
The MongoDB Go Driver is an official driver that allows developers to connect to a MongoDB database using the Go programming language. It has been released as a General Availability (GA) version and is now considered feature complete. The tutorial covers how to install the driver, connect to a MongoDB deployment, use BSON objects in Go, and perform CRUD operations such as insert, update, find, and delete documents. The tutorial also emphasizes the importance of connection pooling and closing the connection once no longer required.
Mar 20, 2019 1,620 words in the original blog post.
Calling the MongoDB Atlas API from Go involves using the standard HTTP package and a third-party digest authentication library, as direct support is not currently available. The process begins by importing necessary packages and setting the base URL for the MongoDB Atlas API. Environment variables `ATLAS_USER` and `ATLAS_USER_KEY` are used to authenticate with the API. A transport object is created using these credentials, and a request is sent over this transport. The response is then read and decoded into an interface, which can be further processed or printed in a human-readable format.
Mar 18, 2019 553 words in the original blog post.
The Approximation Pattern is a design approach used in MongoDB to handle calculations that are resource-intensive or not mission-critical, allowing for fewer writes to the database while maintaining statistically valid numbers. This pattern is particularly useful in applications where data accuracy isn't crucial, such as city population estimates or website views, and can significantly improve performance by reducing write operations and CPU usage.
Mar 14, 2019 738 words in the original blog post.
Stitching Sheets: Using MongoDB Stitch To Create An API For Data In Google Sheets aims to integrate data from Google Sheets into a MongoDB database using MongoDB Stitch. A Google Sheets script collects rows of data, posts them to a MongoDB Stitch HTTP Service incoming webhook, and then receives and inserts the data into a MongoDB Database Collection. Another function removes entries from the sheet and updates the eventID reference in the sheet by sending POST requests with form data to a MongoDB Stitch service API. The scripts can be integrated into Google Sheets using the Script Editor, allowing for easy collaboration on events tracking spreadsheet data while making it available outside of Google Sheets through an exposed API.
Mar 13, 2019 1,302 words in the original blog post.
The Extended Reference Pattern is a MongoDB schema design pattern used to improve performance by reducing the need for JOIN operations. It involves duplicating frequently accessed fields from related collections into the main document, rather than embedding or referencing them. This approach eliminates duplicated data and reduces the number of JOINs required, resulting in faster reads and improved performance. The pattern works best when dealing with N-1 relationships, where one entity has multiple instances of another entity, such as orders to customers. By applying this pattern, developers can optimize their MongoDB schema for better performance and scalability.
Mar 07, 2019 800 words in the original blog post.