Skip to content

Commit

Permalink
[Deps] Update to Mongoose 8 (#173)
Browse files Browse the repository at this point in the history
`findOneAndRemove` was an alias that has since been removed. [1]

[1]: https://mongoosejs.com/docs/migrating_to_8.html
  • Loading branch information
dchege711 authored Jun 15, 2024
1 parent ef5a1c1 commit a884d5a
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 46 deletions.
122 changes: 82 additions & 40 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"markdown-it": "^14.1.0",
"markdown-it-texmath": "^1.0.0",
"mongodb": "^4.17.2",
"mongoose": "^7.6.13",
"mongoose": "^8.4.1",
"nodemailer": "^6.9.9",
"path": "0.12.7",
"sjcl": "1.0.7",
Expand Down
2 changes: 1 addition & 1 deletion src/models/LogInUtilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ export async function authenticateByToken(
export async function deleteSessionToken(
sessionTokenID: string,
): Promise<void> {
await Token.findOneAndRemove({ token_id: sessionTokenID }).exec();
await Token.findOneAndDelete({ token_id: sessionTokenID }).exec();
}

export type ResetLinkParams = Pick<IUser, "email">;
Expand Down
2 changes: 1 addition & 1 deletion src/models/MetadataMongoDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ export async function deleteCardFromTrash(
): Promise<string> {
deleteCardArgs = sanitizeQuery(deleteCardArgs);

const card = await Card.findOneAndRemove({
const card = await Card.findOneAndDelete({
_id: deleteCardArgs._id,
createdById: deleteCardArgs.createdById,
}).exec();
Expand Down
6 changes: 3 additions & 3 deletions src/models/mongoose_models/CardSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ export interface ICard {

const cardSchema = new Schema<ICard>(
{
title: { type: String, trim: true, required: true },
description: { type: String, trim: true, required: true },
descriptionHTML: { type: String, trim: true, required: true },
title: { type: String, trim: true, default: "" },
description: { type: String, trim: true, default: "" },
descriptionHTML: { type: String, trim: true, default: "" },
tags: { type: String, lowercase: true, trim: true, default: "" },
urgency: { type: Number, default: 10 },
metadataIndex: { type: Number, default: 0, immutable: true },
Expand Down

0 comments on commit a884d5a

Please sign in to comment.