Syncing to sync gateway doesn't return all docs

Added a sync gateway to couchbase lite ios. It syncs 100 docs but we have 147 in the database. Is there some magic 100 doc limit that is set by default? Any suggestions as to why it’s not syncing all the docs?

There’s no artificial limit like that.

What exactly do you see happening? Describe the steps. How do you know only 100 docs are synced?

I have 144 docs in our couchbase server. In the ios app I’m using the sync manager code from the chat app demo. I use replicationsWithUrl that points to the sync gateway. I’m setting it to continuous. I see progress come in and it looks like it’s batch fetching changes since I see on the server since=public:100; When I look in my database on the device with an _all_docs $get I see 100 rows but they are all revision info and not the documents. So I guess I’m confused. On a fresh install on the device I should get 144 docs listed in the replication call. Secondly why isn’t the replication actually downloading the docs to the device?

Like I said I’m using the sync manager code from the chat example on github. I’m using Beta 2 couchbase lite ios.

Did all 144 docs exist before you started the gateway? And you configured the “importDocs” setting?
Do you have a sync function that assigns channels (or a “channels” property in each doc)? Is the user account the replicator’s logging in with able to see all of the doc channels?

“I see 100 rows but they are all revision info and not the documents” — I’m not sure what this means. _all_docs returns revision info about the documents. It won’t return the doc bodies unless you add the “include_docs” parameter. Have you tried getting any of the docs? (It kind of sounds like you’re using a PhoneGap app? You haven’t specified what language/API.)

I know I’m asking a lot of questions. Once you combine Couchbase Lite and the Sync Gateway the setup is kind of complex with a lot of variables, and details are necessary for figuring out what’s going on.

The gateway was setup by another dev but he says the docs exist in couchbase server but has them setup in the gateway and has the right settings. The docs have a channel prop called public. The test user is guest and we don’t have any restrictions on guest/ unauthenticated. Here’s our sync config

        "sync":`function(doc) {channel("public");}`

Ya it’s sorta hella confusing. I’m using the ios couchlite library. It’s a cordova app so I’m running a phonegap setup but I’m a JS and Objc developer so I can do it in either language. Since the app runs in JS I’d assume I’m going to use the Rest Api to the local couch to get the docs and data I need in the app. Is that correct? Once the app gives me the local url I can just REST via $.ajax right? Should I do the sync replication in native via CBLReplication or using js REST? Currently using the CBLRepl i get stuff like this


That’s not really useful to me. I read something about storing sequence number but that was also horribly vague. Is there any soup to nuts docs for how to connect couchbase lite to a sync gateway and initiate a replication? When I did it using couchDB it was hella simple but sync gateway seems to be very different.

I’m sorry, but this forum website is too awkward to have a real conversation in. Could I ask you to join our mobile mailing list? That’s where most of the real discussions take place. It’s at!forum/mobile-couchbase

I joined the group. Do I need to repost there?

For the benefit of folks coming to this page later I’ll link to the iOS example app as it is probably the easiest to wrangle.

The PhoneGap one is also easy to get started with but there’s an extra abstraction layer.

I’m glad you joined the mailing list.

That demo is not using phonegap. Is there a demo of couchlite with sync gateway using phonegap, that doesn’t also use coax?

Yes; sorry for the inconvenience. You can just copy and paste the content of the two messages you posted above. Thanks!

There is plenty of code out there for doing JSON xhr requests. My new favorite is just this small module I hope to replace coax with in a few dev cycles. It’s based on mikeal’s request which is a great way to go if you are using browserify.

If you want to just use $.ajax or raw XHR, that will work. I’m sorry the PhoneGap example doesn’t do that. There is this REST API reference that should help you use any Ajax library.

If there are specific lines of code in the example app that you are curious about I’m happy to help, either here or on the google group.