Mass Assignment
Learn about the pros and cons of mass assignment.
We'll cover the following...
What is mass assignment?
Mass assignment is an incredibly useful tool. When used properly, it can speed up development time. But it can cause severe damage if used improperly. This functionality is usually included as part of an Object Relational Mapper (ORM) or Object Document Mapper (ODM). ORMs aren’t as popular in Node as they are in other languages, but they come up occasionally. ODMs are popular if you use MongoDB, CouchDB, or another schema-less document database.
In the examples below, we’ll use Mongoose. Mongoose is a MongoDB object modeling tool for Node.js…
Let’s say you have a User
model that needs to be updated with several changes. You could update each field ...