Re: Creating read-only document?

2014-10-15 Thread ajres
@MobDev There are a number of features available to you in the sync function that can restrict who can create and modify documents e.g for the following doc format. {_id: ACA9083F, owner: alice, readers: [bob,…], category: riddle, text: Why is a… } You might use these in your sync

Re: How does the CBLModel work in swift?

2014-10-15 Thread Karel-Jan Van Haute
So how to do this in Swift @interface Note : CBLModel @property (copy) NSString* text; @property NSDate* created; @property bool checked;// bool not BOOL! See below for why @end And here's the implementation of the class: @implementation Note @dynamic text, created, checked; // marks these

Re: propertynameItemClass in swift

2014-10-15 Thread Karel-Jan Van Haute
Hey Julian you say that you have working swift code to use CBLModel and link the properties right with @NSManaged? If so, can you share a class? As an example? Thank you On Tuesday, September 16, 2014 3:23:29 AM UTC+2, Julian Paas wrote: Yes @NSManaged is the same as @dynamic and is

Re: Apache CouchDB vs CouchBaseLite: difference in revisions hashes

2014-10-15 Thread Igor Ievsiukov
Hi Jens, Thank you for your reply. (if I recall correctly) CouchDB doesn't digest the JSON but rather the serialized Erlang term that represents it; yeah, in this case it will be impossible to generate rev same as in couchdb. I do understand that this is quite a rare use-case, but I just got

Re: propertynameItemClass in swift

2014-10-15 Thread Julian Paas
Here's the simplest CBLModel class I have at the moment class Team: CBLModel { @NSManaged var name: String @NSManaged var type: String class func teamsByName() - CBLQuery { let query = databaseMain.viewNamed(kCblViewTeamsByName).createQuery() return query } // Because class

Re: overriding CBLModel designated initializer in Swift

2014-10-15 Thread Julian Paas
It looks something like... class func newInstance(team: Team!) - Game // Use the designated initializer let game = Game(newDocumentInDatabase: team.database) // Do whatever inititalization you want to do here. In my case I needed to do some initialization based on the team

Re: Prefixing an Document ID Generated by Couchbase

2014-10-15 Thread Steve
Too easy, thanks Jens. On Monday, 13 October 2014 17:01:24 UTC+13, Jens Alfke wrote: On Oct 12, 2014, at 2:25 AM, Steve s.ande...@gmail.com javascript: wrote: Is it possible to prefix a document ID created by Couchbase? I know I can't modify the ID of a document, but I would like

Re: How does the CBLModel work in swift?

2014-10-15 Thread Jens Alfke
On Oct 15, 2014, at 12:44 AM, Karel-Jan Van Haute karel...@gmail.com wrote: Can someone provide me with a small example on how to implement the CBLModel in swift? Search the list archives for swift and you'll find a few prior threads about using CBLModel, including the syntax for

Re: How does the CBLModel work in swift?

2014-10-15 Thread Karel-Jan Van Haute
Ok I think I have it. So I will post my solution here for the lost ones. I'm not sure this is the right way to do it. But it works for now. I've made a general Model that adds created date and the last modified date. import Foundation typealias CBLDoc = CBLDocument class Model: CBLModel{

Re: How does the CBLModel work in swift?

2014-10-15 Thread Jens Alfke
init(inDatabase database: CBLDatabase, ofType type: String){ super.init(document: self.document) That's not the right inherited initializer. (In particular, it should be a red flag that you're calling a method on self before calling the superclass initializer. I'm surprised

Re: couchbase lite for chormebook

2014-10-15 Thread Jens Alfke
On Oct 14, 2014, at 7:56 PM, Siddique Ahmad siddique.ah...@gmail.com wrote: any app available for chromebook ? Chrome OS is basically a web browser, so you'd need a browser-based equivalent of Couchbase Lite. Currently that's PouchDB http://pouchdb.com/. It's based on the CouchDB

Re: Idea: Sync function utilities

2014-10-15 Thread Jens Alfke
I've implemented required( ) and immutable( ), on a new branch feature/sync_utils. Feel free to try them out. There's also a deepEqual(a, b) function that I needed as a subroutine of immutable. It acts like === but compares the the contents of arrays and objects, i.e. it compares them for

Re: Creating read-only document?

2014-10-15 Thread MobDev
Got it, Thanks a lot. Cheers, On Tuesday, October 14, 2014 7:16:37 PM UTC-4, MobDev wrote: Hey guys, is it possible to create read only document? We are pushing global documents to all users using channels and roles. lets say someone accessed the cblite file and changed the global