I'm trying to update almost all the fields in my schema except for _id and __v, here's the code so far:
for (var field in SchemaTarget.schema.paths) {
if ((field !== '_id') && (field !== '__v')) {
//all fields except _id and __v
}
}
now, how can I set for example: doc.field = something;
? Also I've seen this: doc[field] = something
, what's the difference?