> On Jun 2, 2015, at 11:04 AM, Florion COIFFÉ <[email protected]> wrote: > > 1. I have to manually add a .creator property to all my table in my iPad > database, right?
You mean “documents”, right? Couchbase doesn’t have tables, those are a relational-db thing. Yes, if you want the documents to have a “creator" property you have to add it. > 2. When we say "user_id", "owner", "creator", etc. There are arbitrary names > we choose as developers right ? There is no Couchbase special property like > "type", or "rev” ? Couchbase reserves property names that start with an underscore “_”, like “_id”, “_rev”, “_attachments”. Anything else is free for you to use. > 3. I got how to prevent creating or updating documents. But how do I prevent > a user to see other users' document ? A user can only see documents that are assigned to channels s/he has access to. So to hide documents, don’t assign those documents to the users’ channels. A typical way to do this is to have a naming convention for channels named after users, for example when you create user “alice” you give her access to channel “for:alice”. Then in the sync function to give user x access to a document you assign it to channel “for:”+x. > 4. On last thing, sorry. In the couchbase-lite-iOS repository, the > CBLIncrementalStore takes care of dynamically adding a "type" property to > each document based on the table name in the datamodel. My idea was to do the > same thing for "creator" property so it is automatically added in couchbase > documents without having it in the datamodel since I consider it is a > Couchbase (meta?)data that I don't need to know about since every data I have > on the iPad was created by the user anyway. I don’t know Core Data very well. You can declare that property in your NSManagedObject subclass, but you’ll also have to ensure it gets assigned a default value (the username), or manually assign the value when you create a new document. —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/D54DB8C6-4BC2-439D-AEB2-F424FE304C4B%40couchbase.com. For more options, visit https://groups.google.com/d/optout.
