Merge pull request #16186 from overleaf/mj-mongo-object-id

[web] Use constructor for ObjectId

GitOrigin-RevId: 9eb8b377ea599605b72af237d1ab12f4d8287162
This commit is contained in:
Mathias Jakobsen
2023-12-19 09:04:02 +00:00
committed by Copybot
parent 0ac514f81b
commit c371732e6e
100 changed files with 423 additions and 368 deletions
@@ -42,7 +42,7 @@ describe('History', function () {
this.v1_history_id = 42
return db.projects.updateOne(
{
_id: ObjectId(this.project_id),
_id: new ObjectId(this.project_id),
},
{
$set: {
@@ -90,7 +90,7 @@ describe('History', function () {
}
this.v1_history_id = 42
db.projects.updateOne(
{ _id: ObjectId(this.project_id) },
{ _id: new ObjectId(this.project_id) },
{
$set: {
'overleaf.history.id': this.v1_history_id,
@@ -202,7 +202,7 @@ describe('History', function () {
}
return db.projects.updateOne(
{
_id: ObjectId(this.project_id),
_id: new ObjectId(this.project_id),
},
{
$unset: {
@@ -260,7 +260,7 @@ describe('History', function () {
this.v1_history_id = 42
return db.projects.updateOne(
{
_id: ObjectId(this.project_id),
_id: new ObjectId(this.project_id),
},
{
$set: {
@@ -324,7 +324,7 @@ describe('History', function () {
this.v1_history_id = 42
return db.projects.updateOne(
{
_id: ObjectId(this.project_id),
_id: new ObjectId(this.project_id),
},
{
$set: {
@@ -34,7 +34,7 @@ async function main() {
}
await db.users.updateOne(
{ _id: ObjectId(userId) },
{ _id: new ObjectId(userId) },
{ $set: { 'features.compileTimeout': compileTimeout } }
)
}
@@ -22,7 +22,7 @@ async function testTransactions() {
const session = mongoClient.startSession()
try {
await session.withTransaction(async () => {
await db.users.findOne({ _id: ObjectId() }, { session })
await db.users.findOne({ _id: new ObjectId() }, { session })
})
} finally {
await session.endSession()