It works fine, this attaches the attachment and push to server. I have 2 questions.
it is creating always new revision of the existing document. Is it possible to use the previous revision of the document and just attach the attachment alone?
Where will be this attachment saved on the server or sync gateway after pushing from iOS App? what is the path over there? I can access this attachment using Rest API’s, no problem, But i want to know in which path these attachment files will be stored on the backend server or sync gateway?
No, the attachment is part of the revision, so to change an attachment you have to create a revision.
Could you please explain about changing the attachment? My concern was, just pushing an attachment for the existing document, not like changing the attachment.
Are you saying that my code in the original post does work perfectly, i mean it has to create new revision like that every time when we attach an attachment with the existing document?
Yes, you need to create a new revision every time you add an attachment. You’re making a change, so that has to be tracked as a new revision.
Nothing is persisted on Sync Gateway normally. There’s no path to your attachment. On Couchbase Server it’s stored in the database bucket. You should not count on knowing internals there.
What are you trying to achieve by knowing the attachment location? We might be able to give you more help if you can describe the goal.