Skip to content

Commit

Permalink
Remove version field in question document
Browse files Browse the repository at this point in the history
  • Loading branch information
Jweng88 committed Sep 15, 2024
1 parent caa9e46 commit 9f46fbf
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions question-service/src/model/question-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,9 @@ questionSchema.pre("save", async function (next) {
next();
});

// Add this option to remove __v automatically
questionSchema.set("toJSON", {
versionKey: false, // This removes the __v field
});

export default mongoose.model<QuestionDocument>("Question", questionSchema);

0 comments on commit 9f46fbf

Please sign in to comment.