Problem in ionic

Hi
I’m a hybrid mobile app developer and i’m using ionic framework

i have a problem while updating a document the syntax was
updateDocument(documentId, documentRevision, jsonDocument)

i pass all the values but i received 406 response (not acceptable).

please help me to solve this and i need a complete tutorial about your cordova plugin functions

We don’t have an official JavaScript API, so that updateDocument function must be from an unofficial source; your best bet would be to ask the developers of that API, maybe via an issue on their Github repo if there is one.

The JS API is ultimately sending HTTP requests to Couchbase Lite’s REST API, which is what we support. If you know the exact HTTP request that’s being sent and have an issue with it, we can answer that.

(We’d like to offer a supported JS API, but we just haven’t had the resources to do so yet.)

hi jens thanks for your reply

hi

i’m developing the app based on the reference

https://blog.couchbase.com/data-synchronization-with-couchbase-in-ionic-2-hybrid-mobile-apps/

this is not your blog i used your suggested plugin

Tagging @nraboy who authored the blog . As mentioned by Jens, we don’t have “official” support for a JS API.

The blog post references an unofficial wrapper that I had built:

The wrapper only gives you an API that issues CRUD requests via HTTP under the covers so you don’t have to burden yourself with it.

Best,

Hi

Thanks for your reply

i used your update function but it returns 406 error and i need a one more help how can i filter a documents by a common id

hi

i need to store multiple phone numbers like

“Phone” :
[{
“Number” : xxxxxxxxx,
“extn” : xxx,
“pType” :x
}],

i need to fix this on mobile ,help me to fix this

Hi

looking for your reply

This is a very broad question, and it’s not clear what you’re asking. You’ll have better luck reading the docs and trying things on your own, and asking focused questions about specific problems.

Hi Jens

i’m developing a application with the reference of https://github.com/couchbaselabs/cordova-couchbase

i having problem on update function ,update function has three parameters like,documentId,documentRev and jsonDocument

i passed current docid,docrev, and updated json doc but i got 406 not acceptable error.how can i fix this

and the revision value is need to update a new one or can i pass the revision what was created while creating a document

Thanks

I don’t know why an update would return a 406 error; normally that error only happens with a GET request, if the requested response type isn’t available. I think this problem has something to do with the Ionic wrapper code you’re using.

Whenever you update a document, you have to pass the revision ID that the document had when you retrieved it:

  1. GET (or PUT) document
  2. Get the revision ID from the response
  3. Modify the document properties
  4. PUT the change, including the revision ID from step 2.

Hi Jens

thanks for your reply i tried the steps what you said but still get 406 error please check the image belowcouchissue1

I don’t know anything about the updateDoc function, that’s part of an unofficial JS wrapper.

Please show the headers & body of the PUT request that generated the error. Something’s wrong with them.

Hi Jens

i attached my headers below plz check

header2

hi jens

please share your official js wrapper

The request is sent with a Content-Type text/plain, which is incorrect: documents have to be application/json. (Paging @nraboy).

You can find instructions on using Couchbase Lite in a PhoneGap/Cordova container here, including use of the supported API.

Sorry the blog post got you off on the wrong foot … it should have been more clearly marked as an unofficial project.

Hi @nraboy

i’m using your cordova plugin i have few doubts on it please help me to fix this

  1. the queryView() function has options parameter what is purpose for that and how to use it.

  2. there is any possible to get a document by other parameters like can i get users doc by userId

Hi team.
i can’t update localy and in the server.
it is not pushing update to the server. Using sync gateway, CreateDocument and Delete function are working properly in my aplication and the Couchbase server sync is also working correctly through syncgateway. but while using update i see the status code 200 in the sync but any change has done localy and in the couchbase server.

Help please.