Regarding the approach suggested of assigning each user to a private channel: does that scale well ? By well I mean, at the degree that a couchbase server scales?
I'm asking because I read somewhere that the gateway doesn't use local storage (only RAM) - correct me if I'm wrong; So I got concerned about the scaling if doing it this way. Can we use and abuse of channels as we wish? Thiago On Monday, September 29, 2014 7:40:33 PM UTC+2, Jens Alfke wrote: > > > On Sep 29, 2014, at 5:25 AM, Thiago Alencar <[email protected] > <javascript:>> wrote: > > This document is newer, so I believe sync gateway will make this the > winning revision from the conflict > > > That's correct as long as by "newer" you mean "has more revisions" (i.e. > higher generation count) There isn't any chronological timestamp on a > document. > > After logging in, I first wait for the replication to complete, and just > then I call [database existingDocumentWithID], in the hope that now I'll > get the document instead of creating a new one. > But no, I'm still not able to find the document and therefore I have no > access to the "blobData" generated from the first device. > > > Sounds like the document isn't in any channel your user account can read. > > And already to advance / confirm: right now I have basically nothing in my > sync function > > > The default sync function will assign the channels listed in the > document's "channels" property. Since you didn't add such a property to > your document, it's not in any channels. So unless you gave the user access > to the wildcard "*" channel, the user won't be able to see the document, > explaining your problem. > > There are many ways to solve this, depending on your apps' goals. A simple > one is: > > - Define a private channel for each user, named something like "user-" > + username > - When creating a user account, add that channel to their > admin_channels property > - When creating documents, add a "channels" property whose value is an > array containing the user's channel > > > An even simpler one is to give every user account access to the "*" > channel, although you'd only want that for experimentation, probably. > > This isn't the first time new developers have run into this, and I'm > realizing that it's a problem with the Gateway's default settings — they > create a situation where you can't read your own writes, which is > unexpected. > > —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/b7d6180c-4188-4e43-82fc-0e64a86cfd35%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
