Since the introduction of the namespaced views, passing a document name that starts with “dev_” will automatically set the namespace of the request to development, regardless of the current value.
While I understand the desire to mimic the previous behaviour, I consider this to be a bug because it prevents someone from using a document name starting with “dev_” in production, knowingly.
The simple fix is to also check if the namespace has been defined by the user or not :
if (designDoc.name.startsWith('dev_') && namespace === undefined) {
// same logic
}
See couchnode/lib/viewindexmanager.ts at master · couchbase/couchnode · GitHub