Loading only a subset of my data when querying couchbase?

I am using Couchbase as a nosql database solution for my android app, but I have been having problems loading my data. My app features forms that users can fill out and then view a list of all the forms they’ve filled out and submitted so they can view and edit their answers. My back end server is running Couchbase 3.0.1 community edition and my app is running Couchbase-lite 1.0.3

My problem is that sometimes when I query couchbase, it returns all my data but sometimes it only returns a subset of my data. For example, I have 15 forms right now but sometimes it will only find 13 or 14. Viewing the list of filled-out form records is unreliable and I often see less records in the list than I know there should be, although I know the data isn’t missing because the rest of the records will pop back up spontaneously later. Even letting the phone go to screensaver and then opening it back up and resuming the app will often show a different amount of records in the list than there were before. I am also not always able to log in with all of my user accounts, as sometimes the query for users will only return 25 or so of my 36 existing users and if the account I am trying to use is not one of the ones found, I won’t be able to use it to log in.

I think I have noticed that my older data is more reliable than my newer data, but it’s hard to say for sure since it’s so variable every time I load the app. But my original user account can always log in, while my newer account that I made recently for testing can only log in about half the time.

Why isn’t all of my data being found in the query and is there a way that I can force Couchbase to make sure it is getting all existing data?

What version of Sync Gateway are you using? This sounds similar to some issues that were fixed in version 1.1 — sometimes the “changes feed” generated by the Gateway was missing some changes, so the client didn’t know to pull them.

If you upgrade to 1.1 and this persists, please reply and we’ll help you troubleshoot it.

We are running “Couchbase Sync Gateway Community 1.0.3”

I will install the upgrade, use it for a while, see if the issue persists at all and report back! Thank you for your reply!

Just to clarify, when you say “upgrade to 1.1” do you mean upgrade the sync gateway or the version of couchbase-lite I’m using in the android project or both?

I meant SG, but it would be good to update both — there are a ton of performance improvements and bug fixes in the Android 1.1 (:

Okay, my back-end server is now running “Community 3.0.1” version of couchbase and “Enterprise 1.1.0” version of sync gateway and I have been experiencing the same problems as in my original post ):

Is it possible there’s anything additional I need to do to set up the new version of Sync Gateway? Otherwise I think I have to say that my problem is persisting through versions.

Hm, I think you’ll need to get help from an Android or SG developer, like @hideki or @march44.


Hi, can you run the following curl commands against your sync_gateway and report the results against what you expect to see.

curl -X GET http://user:password@yoursyncgateway:4984/yourdb/_all_docs

curl -X GET http://user:password@yoursyncgateway:4984/yourdb/_changes

Both of the above commands will filter the documents based on the channels the user has access to.