Fix for #9739 - there was an issue with the mango syntax, when working with multi attachment columns it was using an AND comparator instead of OR, it should be searching for rows that contain any attachment column, not all attachment columns.

This commit is contained in:
mike12345567 2023-03-01 19:01:13 +00:00
parent df40c97c45
commit b88f9aaa14
2 changed files with 6 additions and 2 deletions

View File

@ -86,7 +86,11 @@ export const runMigration = async (
count++
const lengthStatement = length > 1 ? `[${count}/${length}]` : ""
const db = getDB(dbName)
const db = getDB(dbName, { skip_setup: true })
// DB doesn't exist - no-op required
if (!(await db.exists())) {
continue
}
try {
const doc = await getMigrationsDoc(db)

View File

@ -13,13 +13,13 @@ function generateAttachmentFindParams(
) {
const params: CouchFindOptions = {
selector: {
$or: attachmentCols.map(col => ({ [col]: { $exists: true } })),
_id: {
$regex: `^${DocumentType.ROW}${SEPARATOR}${tableId}`,
},
},
limit: FIND_LIMIT,
}
attachmentCols.forEach(col => (params.selector[col] = { $exists: true }))
if (bookmark) {
params.bookmark = bookmark
}