1

New to couchdb. I came to know that temporary views cannot be created in couchdb 2.0. Is there anyway to create a design doc in couchdb using django. Am looking for an alternative way to do the below code

server = couchdb.Server(url)
db = server['test']
func_str = "function(doc) { emit(doc.count,1); }" 
results = db.query(func_str)
for row in results:
    i=row.key
    print("i:",i)
dict=json.loads(i)

The above code gives me error: 410, ('gone', 'Temporary views are not supported in CouchDB'))

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Teenu TTT
  • 27
  • 2
  • Just create a standard view, then delete it when you're done with it. – Jonathan Hall May 06 '18 at 14:42
  • by standard view do u mean to create it couchdb server directly. Am trying to automate it. is it possible through code? – Teenu TTT May 07 '18 at 04:14
  • Of course it's possible through code. Just push a design document, and when you're done delete it. – Jonathan Hall May 07 '18 at 07:02
  • thanks. but how to push a design doc? – Teenu TTT May 07 '18 at 07:42
  • The same way you push a normal doc, but with the proper name and format. You would do well to [read the docs](http://docs.couchdb.org/en/2.1.1/api/ddoc/common.html). – Jonathan Hall May 07 '18 at 07:42
  • Sorry really not getting it. May be some basic error. please help. I was trying to create a design doc like this and thought to add a view function to doc later but gets error. Missing request body curl -X PUT http://localhost:5984/twitter/Names – Teenu TTT May 09 '18 at 04:51
  • I can't help you with a curl command I can't see. But the error indicates you're missing the request body. – Jonathan Hall May 09 '18 at 08:20

0 Answers0