So I just recently begun playing with the MEAN stack and I noticed that mongo (with mongoose) was creating embedded _id props (the yellow highlight) for objects within arrays. Wanted to know if anyone knew if this was a normal occurrence and if its ok or if it signals an issue in my schema design (the schema pretty much looks like that). Pardon my horrible coloring. Thanks.
Asked
Active
Viewed 85 times
0
-
3This is an expected behavior for sub-objects in your schema. If you don't want those ids check : http://stackoverflow.com/questions/17254008/stop-mongoose-from-created-ids-for-subdocument-arrays – Pierre Maoui Jun 15 '15 at 11:24
-
@PierreMaoui thanks. – Cozzbie Jun 15 '15 at 11:32
-
Use `{ "_id": false}` in your schema definition for the "sub-document". It's an option like `Schema({ //def here },{ "_id": false })` on the embedded schema definition to turn this off. If you want to turn it off that is. It's probably quite handy to have. – Jun 15 '15 at 11:36