File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -4070,15 +4070,17 @@ Document.prototype.$__toObjectShallow = function $__toObjectShallow(schemaFields
4070
4070
*
4071
4071
* If you want to skip transformations, use `transform: false`:
4072
4072
*
4073
- * schema.options.toObject.hide = '_id';
4074
- * schema.options.toObject.transform = function (doc, ret, options) {
4075
- * if (options.hide) {
4076
- * options.hide.split(' ').forEach(function (prop) {
4077
- * delete ret[prop];
4078
- * });
4073
+ * schema.options.toObject = {
4074
+ * hide: '_id',
4075
+ * transform: function(doc, ret, options) {
4076
+ * if (options.hide) {
4077
+ * options.hide.split(' ').forEach(function(prop) {
4078
+ * delete ret[prop];
4079
+ * });
4080
+ * }
4081
+ * return ret;
4079
4082
* }
4080
- * return ret;
4081
- * }
4083
+ * };
4082
4084
*
4083
4085
* const doc = new Doc({ _id: 'anId', secret: 47, name: 'Wreck-it Ralph' });
4084
4086
* doc.toObject(); // { secret: 47, name: 'Wreck-it Ralph' }
You can’t perform that action at this time.
0 commit comments