new keyworkd for objectid
This commit is contained in:
parent
3b63f02dd7
commit
4f12444a9d
@ -64,7 +64,7 @@ class UserDatabase extends AbstractUserDatabase {
|
|||||||
if (id.includes('temp'))
|
if (id.includes('temp'))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
const data = await this.db.findOne(this._userColllection, { _id: ObjectId(id) });
|
const data = await this.db.findOne(this._userColllection, { _id: new ObjectId(id) });
|
||||||
if (!data)
|
if (!data)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ class UserDatabase extends AbstractUserDatabase {
|
|||||||
if (!force && this.cache.has(id))
|
if (!force && this.cache.has(id))
|
||||||
return this.cache.get(id);
|
return this.cache.get(id);
|
||||||
|
|
||||||
const data = await this.db.findOne(this._appCollection, { _id: ObjectId(id) });
|
const data = await this.db.findOne(this._appCollection, { _id: new ObjectId(id) });
|
||||||
if (!data)
|
if (!data)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@ -238,11 +238,11 @@ class UserDatabase extends AbstractUserDatabase {
|
|||||||
return false;
|
return false;
|
||||||
if (result.created + result.validFor < Date.now()) {
|
if (result.created + result.validFor < Date.now()) {
|
||||||
// Code existed but is no longer valid
|
// Code existed but is no longer valid
|
||||||
await this.db.deleteOne('registrationCodes', { _id: ObjectId(result._id) });
|
await this.db.deleteOne('registrationCodes', { _id: new ObjectId(result._id) });
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Valid code
|
// Valid code
|
||||||
await this.db.deleteOne('registrationCodes', { _id: ObjectId(result._id) });
|
await this.db.deleteOne('registrationCodes', { _id: new ObjectId(result._id) });
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,7 +256,7 @@ class UserDatabase extends AbstractUserDatabase {
|
|||||||
const { json } = user;
|
const { json } = user;
|
||||||
this.logger.debug(`Updating user ${inspect(json)}`);
|
this.logger.debug(`Updating user ${inspect(json)}`);
|
||||||
if (user._id)
|
if (user._id)
|
||||||
await this.db.updateOne(this._userColllection, { _id: ObjectId(user._id) }, json);
|
await this.db.updateOne(this._userColllection, { _id: new ObjectId(user._id) }, json);
|
||||||
else {
|
else {
|
||||||
const result = await this.db.insertOne(this._userColllection, json);
|
const result = await this.db.insertOne(this._userColllection, json);
|
||||||
user._id = result.insertedId;
|
user._id = result.insertedId;
|
||||||
@ -267,7 +267,7 @@ class UserDatabase extends AbstractUserDatabase {
|
|||||||
async updateApplication (app) {
|
async updateApplication (app) {
|
||||||
const { json } = app;
|
const { json } = app;
|
||||||
this.logger.debug(`Updating application ${inspect(json)}`);
|
this.logger.debug(`Updating application ${inspect(json)}`);
|
||||||
await this.db.updateOne(this._appCollection, { _id: ObjectId(json._id) }, json, true);
|
await this.db.updateOne(this._appCollection, { _id: new ObjectId(json._id) }, json, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user