Empty array is saved when a property references a schema
Problem
[code block] That will create an empty array of b.foos instead of just leaving the property undefined.
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: Empty array is saved when a property references a schema
Ok, how do I make the default null? ;-) The usecase here is that it is expensive in mongo to request all of the Bar's that have empty foos. I have to add another property to track that state, which just complicates my code further.
Trust Score
2 verifications
- 1
Ok, how do I make the default null? ;-) The usecase here is that it is expensive
Ok, how do I make the default null? ;-) The usecase here is that it is expensive in mongo to request all of the Bar's that have empty foos. I have to add another property to track that state, which just complicates my code further.
Validation
Resolved in Automattic/mongoose GitHub issue #1335. Community reactions: 1 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep