In other situations, such as when edits are being made to user data, it’s helpful to treat a managed object context as a set of changes that the app can discard if it no longer needs them. In this tutorial, you’ll learn about multiple managed object contexts by taking a journaling app for surfers and improving it in several ways by adding multiple contexts.
This is an advanced tutorial, and assumes prior knowledge of Swift, Core Data, and i OS app development in general.
That being said, certain situations do warrant the use of more than one managed object context.
When using the deprecated MMAPv1 storage engine, document growth can be a consideration for your data model.
For MMAPv1, if the document size exceeds the allocated space for that document, Mongo DB will relocate the document on disk.
Starting with Mongo DB 3.0, however, the default use of the minimizes the occurrences of such re-allocations as well as allows for the effective reuse of the freed record space.
When using MMAPv1, if your applications require updates that will frequently cause document growth to exceeds the current power of 2 allocation, you may want to refactor your data model to use references between data in distinct documents rather than a denormalized data model.
Consider using the TTL feature if your application requires some data to persist in the database for a limited period of time.
Additionally, if your application only uses recently inserted documents, consider ) and adding new fields to a document.Modeling application data for Mongo DB should consider various operational factors that impact the performance of Mongo DB.For instance, different data models can allow for more efficent queries, increase the throughput of insert and update operations, or distribute activity to a sharded cluster more effectively.There would be fewer copies of the common fields for more information on indexes.However, if you often only need to retrieve a subset of the documents within the group, then “rolling-up” the documents may not provide better performance.After each surf session, a surfer can use the app to create a new journal entry that records marine parameters, such as swell height or period, and rate the session from 1 to 5.