Change $type of date for todos (#12779)

* change $type to date for task and add new test

* adjust apidocs to reflect type change

* migration test for api date $type change

* minor fixes to migration

* unset instead of set empty string

* add type filter

* fix(todo date migration): make sure the update command works and limit update ops

Co-authored-by: Matteo Pagliazzi <matteopagliazzi@gmail.com>
This commit is contained in:
Shadow
2020-12-24 11:37:09 -06:00
committed by GitHub
parent 2c44f766cd
commit 7c0b3612f0
4 changed files with 77 additions and 5 deletions

View File

@@ -404,8 +404,7 @@ export const daily = Task.discriminator('daily', DailySchema);
export const TodoSchema = new Schema(_.defaults({
dateCompleted: Date,
// TODO we're getting parse errors, people have stored as "today" and "3/13". Need to run a migration & put this back to $type: Date see http://stackoverflow.com/questions/1353684/detecting-an-invalid-date-date-instance-in-javascript
date: String, // due date for todos
date: Date, // due date for todos
}, dailyTodoSchema()), subDiscriminatorOptions);
export const todo = Task.discriminator('todo', TodoSchema);