How to update customised couchbase information by phone app?


When creating my documents via the phone app, It would create tons of _id strings which would be very long and annoying to sort through so, I re-created my own database with custom _id and rev values such as so:

  "_sync": {
    "rev": "rev0012",
    "sequence": 15,
    "recent_sequences": [
    "history": {
      "revs": [
      "parents": [
      "channels": [
    "time_saved": "2017-04-11T10:47:52.600440886+08:00"
  "correction1": "",
  "correction2": "",
  "direction": [],
  "parkSpot": "004",
  "pid": 12,
  "plateNum": "",
  "position": [
  "state": 0,
  "lastCheck": ""

However, when I am running it on my android phone up with the intent to update the information, it replies with :

 There was an Error with the update in query: sortByParkSpot
 com.couchbase.lite.CouchbaseLiteException, Status: 494 (HTTP 400 Invalid database/document/revision ID)

This error comes from the putProperties method I used after adjusting the new properties of the current document.

As the error involves the “putRevision” method from the sdk, I am assuming the issue is with the ‘rev’ variable. So, is there any way to quickly fix all my rev variables?

And if I’m wrong what would be the right way to fix it, avoiding manually re-entering all my data?

You can’t edit _rev values. They have a specific format and specific meanings, and the values you’ve chosen like "rev0012" are invalid, which is why Couchbase Lite is complaining.

And in general, you should never directly modify documents in Sync Gateway’s bucket, especially the _sync field. This is private internal data. If you modify it you’re very likely to break things that Sync Gateway and/or Couchbase Lite depend on, as you’ve discovered.

If you want shorter document IDs, then you can create the documents using documentWithID passing in an ID of your choosing; if the document doesn’t exist you’ll get a new Document object, and saving that Document will create it persistently in the database.