>
> 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.
>
>
Ah excellent. I'm glad I asked about this. That'll be important to know.

One of the reasons I wanted to do this is just to have separation of 
regular data and metadata. The metadata information could be saved out 
separately to a file in order for someone to share a complete template of 
their database without having to include all of the regular data. I know I 
could probably do this in code by reading all the metadata separately from 
the regular data and dumping it to a separate file, but it would be super 
easy to simply copy the metadata database independently of the regular data 
database and bang, you have an empty database with everything setup already 
for you ready to enter your regular data.

Thanks!

Brendan


On Tuesday, July 7, 2015 at 2:50:42 PM UTC-6, Jens Alfke wrote:
>
>
> On Jul 7, 2015, at 1:22 PM, Brendan Duddridge <[email protected] 
> <javascript:>> 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/5bcf2069-7eab-41f2-a4c7-f6738a2708e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to