question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hello! If in model schema we define field as array of strings ({ type: [String] }), previously (before 4.4) it was possible to avoid creating empty array in database record on document saving , if assign undefined to corresponding document field. But after update to 4.4 I can’t avoid creating empty array.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:22

github_iconTop GitHub Comments

4reactions
r3wtcommented, Feb 12, 2018

You know what bugs it causes. Don’t be dishonest and play stupid. It causes bugs if you expected the property to not be set,but instead its an empty array.

On Feb 12, 2018 2:59 PM, Valeri Karpov notifications@github.com wrote:

Can you provide some examples?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Automattic/mongoose/issues/4037#issuecomment-365059801, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AERo_cdym9iIs4Fc3uV01rcYXmuEJp8eks5tUKYpgaJpZM4H-e1E.

4reactions
r3wtcommented, Feb 12, 2018

No

On Feb 12, 2018 2:59 PM, Valeri Karpov notifications@github.com wrote:

Can you provide some examples?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Automattic/mongoose/issues/4037#issuecomment-365059801, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AERo_cdym9iIs4Fc3uV01rcYXmuEJp8eks5tUKYpgaJpZM4H-e1E.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I empty an array in JavaScript? - Stack Overflow
Ways to clear an existing array A : Method 1. (this was my original answer to the question) A = [];. This code...
Read more >
4 Ways to Empty an Array in JavaScript
The second way to empty an array is to set its length to zero: a.length = 0;. The length property is read/write property...
Read more >
How to Check if a JavaScript Array is Empty or Not with .length
To check if an array is empty or not, you can use the .length property. ... An empty array will have 0 elements...
Read more >
In Javascript how to empty an array - Tutorialspoint
There are multiple ways to clear/empty an array in JavaScript. You need to use them based on the context. Let us look at...
Read more >
Empty an Array in JavaScript | Scaler Topics
There are various methods to empty an array in JavaScript. ; Assigning the array to an empty array is the quickest method of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found