Data management when modifying existing schemas

If you have taken all of the changes outlined in this chapter and added them to your application, you'll probably notice quite early that the list of projects on the user page doesn't display. This is because we have changed the schemaType of createdBy in projectSchema from String to ObjectId. If you create new projects now, they will show up in the list.

In a development environment and a prototyping scenario, like we have here, this isn't a major issue as we can just add in some more temporary test data. If you're dealing with a live environment or pre-existing data that you want to use then you have to be a bit more careful when changing a schema in this way.

There are various ways you can handle ...

Get Mongoose for Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.