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:
parent
a7d5f0fa7e
commit
eba18a4159
|
@ -86,7 +86,11 @@ export const runMigration = async (
|
||||||
count++
|
count++
|
||||||
const lengthStatement = length > 1 ? `[${count}/${length}]` : ""
|
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 {
|
try {
|
||||||
const doc = await getMigrationsDoc(db)
|
const doc = await getMigrationsDoc(db)
|
||||||
|
|
||||||
|
|
|
@ -13,13 +13,13 @@ function generateAttachmentFindParams(
|
||||||
) {
|
) {
|
||||||
const params: CouchFindOptions = {
|
const params: CouchFindOptions = {
|
||||||
selector: {
|
selector: {
|
||||||
|
$or: attachmentCols.map(col => ({ [col]: { $exists: true } })),
|
||||||
_id: {
|
_id: {
|
||||||
$regex: `^${DocumentType.ROW}${SEPARATOR}${tableId}`,
|
$regex: `^${DocumentType.ROW}${SEPARATOR}${tableId}`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
limit: FIND_LIMIT,
|
limit: FIND_LIMIT,
|
||||||
}
|
}
|
||||||
attachmentCols.forEach(col => (params.selector[col] = { $exists: true }))
|
|
||||||
if (bookmark) {
|
if (bookmark) {
|
||||||
params.bookmark = bookmark
|
params.bookmark = bookmark
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue