> On Jul 7, 2015, at 1:22 PM, Brendan Duddridge <[email protected]> wrote:
> 
> I currently have all my data in a single database file. But I'm contemplating 
> splitting it up into two database files. One to store all my metadata and 
> another to store all my regular data. Will there be any complications with 
> this setup in terms of synchronization or just general management of both 
> databases?

You can do it, but it adds complexity and I’m wondering what benefits you think 
you’d get.

The only reason I could see to do this is if you want to keep one database for 
local data and never sync it (although you could also do that with one database 
using a replication filter.) Or if you’re doing something very fancy with 
document IDs and somehow absolutely need overlapping namespaces.

> I'm thinking that I can just have a couple of CBLManagers, each managing a 
> separate database file.

You only need one CBLManager to manage any number of databases.

> When I want to write to one or the other, I'll just create my CBLModel 
> objects to save to the specific database file the documents were created in. 
> I think it should work, but I'm not sure what will happen when it comes to 
> syncing.

Each db has to be synced independently. You can create replications for both of 
them; it shouldn’t be a problem. They’ll sync simultaneously. (Of course it 
won’t be any faster. Probably slightly slower due to bookkeeping overhead.)

> The regular, non-metadata database will reference objects in the other 
> database file, but I don't think that should be a problem since there's no 
> foreign key relationships in Couchbase anyway as it's all managed in the 
> application.

In any CBLModel subclass that has a property that’s a reference to a document 
in the other database, you’ll need to override -databaseForModelProperty:, so 
that it knows which database to look up the docID in.

—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/DBDE070E-128F-4B18-9290-51E81CE123BE%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to