Issue in Creating Views in CB using REST API

I have created the views in CB using REST API. In that, when i was creating the different views in the same ddoc name in REST API command it will overwrite the pervious view. How to overcome this issue? please any one help me to resolve.

Can you show us some examples of what you were sending to the API, please?

Also, which version of Couchbase Server are you using?

I’m using CB 4.0 version.
REST API to create view in CB Console:

  1. I was creating the view in the name of sampleview and ddoc name was dev_sample in Sample bucket.
    curl -X PUT -H ‘Content-Type: application/json’ ‘http://Admin:password@127.0.0.1:8092/Sample/_design/dev_sample’ -d ‘{“views”:{“sampleview”:{“map”:“function (doc, meta){emit(doc.emailId,meta.id, null);\n}”}}, “options”: {“updateMinChanges”: 3, “replicaUpdateMinChanges”: 3}}’
    {“ok”:true,“id”:"_design/dev_sample"}

After that it will create view in the name sample view in CB console.

  1. I was trying to create the another view under the same ddoc.
    curl -X PUT -H ‘Content-Type: application/json’ ‘http://Admin:password@127.0.0.1:8092/Sample/_design/dev_sample’ -d ‘{“views”:{“sampleview1”:{“map”:“function (doc, meta){emit(doc.Age,meta.id, null);\n}”}}, “options”: {“updateMinChanges”: 3, “replicaUpdateMinChanges”: 3}}’
    {“ok”:true,“id”:"_design/dev_sample"}

Next i hit this API it will overwrite the existing view and it will only display the sampleview1 in CB console.

This is the issue i’m getting through REST API. If i create the different views under same ddoc manually, it is working properly. I will get both views under the one ddoc. I was thinking that the syntax is following PUT for creating views, PUT - nature is doing update for existing result. It won’t create a new object. POST will create a new object. But in this scenario POST is not allowed. This is my understanding in this, please help me to do some other solution for this issue.

Still i didn’t get any information for above issue from your end. It has been long time i’m waiting to resolve this issue. Any one please help me out to get rid of this problem.