On Oct 8, 2015, at 7:50 PM, Brendan Duddridge <[email protected]<mailto:[email protected]>> wrote:
What I'm finding is that when I reference field, it seems like it can't be found in the database for some reason and creates a new one. But I know it exists in the database. It seems to eventually find it, but then I'm left with these new empty objects that eventually get deallocated. They're not saved to the database, but they still get created. That definitely shouldn’t be happening; but I’m pretty confident in the code behind this, so I’m going to assume there’s some other explanation :) In particular, there are two invariants: 1. There can only be one CBLDocument instance with a specific document ID in a CBLDatabase. 2. There can only be one CBLModel instance for a CBLDocument. In the cases where this problem occurs, please check the document IDs of the model objects in question, and also check the raw value of the source model's `field` property (which you can get from `model.document[@“field”]`. Also, do you have active replications? One thing that can happen is a race condition where document A gets pulled before document B, but A has a field that references B; if you look at A immediately after it’s inserted, and follow the reference to B, you arrive at an empty document because B doesn’t exist locally yet. But B will get pulled soon thereafter, and you’ll see the document and the model populate with the correct data. —Jens -- You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/8599CC4C-21FF-408E-874D-44913C684549%40couchbase.com. For more options, visit https://groups.google.com/d/optout.
