mirror of
https://github.com/overleaf/overleaf.git
synced 2025-03-15 05:21:57 +00:00
[misc] run the codemod for moving mongo projections into options
This commit is contained in:
parent
54a82b8c62
commit
b37e27f023
2 changed files with 26 additions and 7 deletions
|
@ -26,7 +26,9 @@ module.exports = MongoManager = {
|
|||
_id: ObjectId(doc_id.toString()),
|
||||
project_id: ObjectId(project_id.toString())
|
||||
},
|
||||
filter,
|
||||
{
|
||||
projection: filter
|
||||
},
|
||||
callback
|
||||
)
|
||||
},
|
||||
|
@ -39,7 +41,11 @@ module.exports = MongoManager = {
|
|||
if (!options.include_deleted) {
|
||||
query.deleted = { $ne: true }
|
||||
}
|
||||
db.docs.find(query, filter).toArray(callback)
|
||||
db.docs
|
||||
.find(query, {
|
||||
projection: filter
|
||||
})
|
||||
.toArray(callback)
|
||||
},
|
||||
|
||||
getArchivedProjectDocs(project_id, callback) {
|
||||
|
@ -106,7 +112,9 @@ module.exports = MongoManager = {
|
|||
doc_id: ObjectId(doc_id)
|
||||
},
|
||||
{
|
||||
version: 1
|
||||
projection: {
|
||||
version: 1
|
||||
}
|
||||
},
|
||||
function (error, doc) {
|
||||
if (error != null) {
|
||||
|
|
|
@ -60,7 +60,9 @@ describe('MongoManager', function () {
|
|||
_id: ObjectId(this.doc_id),
|
||||
project_id: ObjectId(this.project_id)
|
||||
},
|
||||
this.filter
|
||||
{
|
||||
projection: this.filter
|
||||
}
|
||||
)
|
||||
.should.equal(true)
|
||||
})
|
||||
|
@ -101,7 +103,9 @@ describe('MongoManager', function () {
|
|||
project_id: ObjectId(this.project_id),
|
||||
deleted: { $ne: true }
|
||||
},
|
||||
this.filter
|
||||
{
|
||||
projection: this.filter
|
||||
}
|
||||
)
|
||||
.should.equal(true)
|
||||
})
|
||||
|
@ -129,7 +133,9 @@ describe('MongoManager', function () {
|
|||
{
|
||||
project_id: ObjectId(this.project_id)
|
||||
},
|
||||
this.filter
|
||||
{
|
||||
projection: this.filter
|
||||
}
|
||||
)
|
||||
.should.equal(true)
|
||||
})
|
||||
|
@ -241,7 +247,12 @@ describe('MongoManager', function () {
|
|||
|
||||
it('should look for the doc in the database', function () {
|
||||
return this.db.docOps.findOne
|
||||
.calledWith({ doc_id: ObjectId(this.doc_id) }, { version: 1 })
|
||||
.calledWith(
|
||||
{ doc_id: ObjectId(this.doc_id) },
|
||||
{
|
||||
projection: { version: 1 }
|
||||
}
|
||||
)
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue