Following the directions here http://tugdualgrall.blogspot.com/2012/12/couchbase-101-create-views-mapreduce.html I have set up some code that pulls a list of IDs from the cache by creaing a view on the fly the first time if it doesn’t exist. The problem is that the first time the view is created one or both of two undesirable behaviors are usually occurring;
- Error “Failed to access the view” is thrown
- 0 results are returned the first time
What do I need to do in order to ensure that the view is fully created and ready to return correct results before I use it? I am calling CouchbaseClient.createDesignDoc(DesignDoc) which internally calls return asyncCreateDesignDoc(doc).get(); I would expect the .get() to block until the view was fully created. I understand that it may take a few seconds for the view to fully index itself, but I am ok with waiting. It is more important to the application that it get results and this is only going to be a one-time process the first time the user runs my Couchbase connector.