Search code examples
javacouchbase-viewcouchbase-java-api

Set development mode for view query in Couchbase Java SDK 2 globally?


I am using play framework with Couchbase. Play framework has a feature of app modes: dev, test, prod. Couchbase view engine also has modes: dev, prod. I want to query all Couchbase views in dev mode while in play framework dev mode and query views in prod modev for play framework prod mode.

With java Couchbase client 1.x I did

systemProperties.put("cbclient.viewmode", "development");

In java sdk 2 I found only how to set dev mode for each query

ViewQuery.development();

Is there similar way to set view mode globally in sdk 2.x?


Solution

  • There is currently no way to globally set the development mode for all ViewQuery.

    However, I don't think you really need to do that. Development mode in couchbase is essentially used for when you are in the process of writing your view, iterating on the view definition and preventing the modifications to run on the entire dataset.

    If you already have a development cluster, it is likely not holding as much data as the production one, so it is not an absolute requirement to use ViewQuery.development() in this case.