Filter out bad id's
This commit is contained in:
@ -1,4 +1,5 @@
|
|||||||
import { Observable, Scheduler } from 'rx';
|
import { Observable, Scheduler } from 'rx';
|
||||||
|
import { ObjectID } from 'mongodb';
|
||||||
import debug from 'debug';
|
import debug from 'debug';
|
||||||
|
|
||||||
const log = debug('freecc:migrate');
|
const log = debug('freecc:migrate');
|
||||||
@ -62,6 +63,7 @@ function buildChallengeMap(userId, completedChallenges = [], User) {
|
|||||||
null,
|
null,
|
||||||
Scheduler.default
|
Scheduler.default
|
||||||
)
|
)
|
||||||
|
.filter(({ id, _id }) => ObjectID.isValid(id || _id))
|
||||||
.map(updateName)
|
.map(updateName)
|
||||||
.reduce((challengeMap, challenge) => {
|
.reduce((challengeMap, challenge) => {
|
||||||
const id = challenge.id || challenge._id;
|
const id = challenge.id || challenge._id;
|
||||||
|
Reference in New Issue
Block a user