fix table view export in prod

This commit is contained in:
Martin McKeaveney 2021-10-07 11:26:09 +01:00
parent 58752cea3e
commit 0fb17e41b7
1 changed files with 7 additions and 0 deletions

View File

@ -2,6 +2,8 @@ const {
ViewNames, ViewNames,
generateMemoryViewID, generateMemoryViewID,
getMemoryViewParams, getMemoryViewParams,
DocumentTypes,
SEPARATOR,
} = require("../../../db/utils") } = require("../../../db/utils")
const env = require("../../../environment") const env = require("../../../environment")
@ -10,6 +12,11 @@ exports.getView = async (db, viewName) => {
const designDoc = await db.get("_design/database") const designDoc = await db.get("_design/database")
return designDoc.views[viewName] return designDoc.views[viewName]
} else { } else {
// This is a table view, don't read the view from the DB
if (viewName.startsWith(DocumentTypes.TABLE + SEPARATOR)) {
return null
}
const viewDoc = await db.get(generateMemoryViewID(viewName)) const viewDoc = await db.get(generateMemoryViewID(viewName))
return viewDoc.view return viewDoc.view
} }