Merge pull request #11869 from overleaf/em-upgrade-mongoose-web
Upgrade Mongoose and the Mongo driver in web GitOrigin-RevId: 2cad1aabe57eae424a9e4c68b2e0062f0e78ffaf
This commit is contained in:
@@ -27,7 +27,7 @@ async function main() {
|
||||
})
|
||||
if (!DRY_RUN) {
|
||||
console.log(`updating doc ${DOC_ID} in mongo for project ${PROJECT_ID}`)
|
||||
const { result } = await db.docs.updateOne(
|
||||
const result = await db.docs.updateOne(
|
||||
{ _id: ObjectId(DOC_ID), project_id: ObjectId(PROJECT_ID) },
|
||||
{
|
||||
$set: { lines, version, ranges },
|
||||
@@ -38,7 +38,11 @@ async function main() {
|
||||
}
|
||||
)
|
||||
console.log('mongo result', result)
|
||||
if (result.n !== 1 || result.nModified !== 1 || result.ok !== 1) {
|
||||
if (
|
||||
result.matchedCount !== 1 ||
|
||||
result.modifiedCount !== 1 ||
|
||||
!result.acknowledged
|
||||
) {
|
||||
throw new Error('unexpected result from mongo update')
|
||||
}
|
||||
console.log(`deleting doc ${DOC_ID} from redis for project ${PROJECT_ID}`)
|
||||
|
||||
@@ -54,8 +54,8 @@ async function updateImage(image, projectIds) {
|
||||
{ _id: { $in: projectIds.map(ObjectId) } },
|
||||
{ $set: { imageName: `quay.io/sharelatex/${image}` } }
|
||||
).exec()
|
||||
console.log(`Found ${res.n} out of ${projectIds.length} projects`)
|
||||
console.log(`Modified ${res.nModified} projects`)
|
||||
console.log(`Found ${res.matchedCount} out of ${projectIds.length} projects`)
|
||||
console.log(`Modified ${res.modifiedCount} projects`)
|
||||
}
|
||||
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user