[misc] mongodb: use findOne and find().toArray()

This commit is contained in:
Jakob Ackermann
2020-09-10 14:54:18 +01:00
parent 0bfe84db47
commit 6d3fa2ee5b
4 changed files with 22 additions and 35 deletions
@@ -190,7 +190,7 @@ describe('MongoManager', function () {
beforeEach(function () {
this.metadata = { mock: 'metadata' }
this.db.projectHistoryMetaData = {
find: sinon.stub().callsArgWith(1, null, [this.metadata])
findOne: sinon.stub().callsArgWith(1, null, this.metadata)
}
return this.MongoManager.getProjectMetaData(
this.project_id,
@@ -199,7 +199,7 @@ describe('MongoManager', function () {
})
it('should look up the meta data in the db', function () {
return this.db.projectHistoryMetaData.find
return this.db.projectHistoryMetaData.findOne
.calledWith({ project_id: ObjectId(this.project_id) })
.should.equal(true)
})