mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
Mongoose: use $type as the typeKey (#10789)
* use $type as the typeKey in mongoose * fix and add tests
This commit is contained in:
committed by
Sabe Jones
parent
490531cc76
commit
79c0499672
@@ -5,7 +5,7 @@ import baseModel from '../libs/baseModel';
|
||||
// A collection used to store mailing list unsubscription for non registered email addresses
|
||||
export let schema = new mongoose.Schema({
|
||||
email: {
|
||||
type: String,
|
||||
$type: String,
|
||||
required: true,
|
||||
trim: true,
|
||||
lowercase: true,
|
||||
@@ -14,6 +14,7 @@ export let schema = new mongoose.Schema({
|
||||
}, {
|
||||
strict: true,
|
||||
minimize: false, // So empty objects are returned
|
||||
typeKey: '$type', // So that we can use fields named `type`
|
||||
});
|
||||
|
||||
schema.plugin(baseModel, {
|
||||
|
||||
Reference in New Issue
Block a user