mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 06:07:21 +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
@@ -4,12 +4,13 @@ import baseModel from '../libs/baseModel';
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
export let schema = new Schema({
|
||||
regId: {type: String, required: true},
|
||||
type: {type: String, required: true, enum: ['ios', 'android']},
|
||||
regId: {$type: String, required: true},
|
||||
type: {$type: String, required: true, enum: ['ios', 'android']},
|
||||
}, {
|
||||
strict: true,
|
||||
minimize: false, // So empty objects are returned
|
||||
_id: false,
|
||||
typeKey: '$type', // So that we can use a field named `type`
|
||||
});
|
||||
|
||||
schema.plugin(baseModel, {
|
||||
|
||||
Reference in New Issue
Block a user