Skip to content

Commit

Permalink
docs(migrating_to_5): add note about overwriting filter properties
Browse files Browse the repository at this point in the history
Fix #7030
  • Loading branch information
vkarpov15 committed Sep 26, 2018
1 parent 9975182 commit 7c2eb93
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion migrating_to_5.md
Expand Up @@ -347,4 +347,14 @@ In mongoose 5 the `required` validator only verifies if the value is an array. T
### debug output defaults to stdout instead of stderr
In mongoose 5 the default debug function uses `console.info()` to display messages instead of `console.error()`.
In mongoose 5 the default debug function uses `console.info()` to display messages instead of `console.error()`.
### Overwriting filter properties
In Mongoose 4.x, overwriting a filter property that's a primitive with one that is an object would silently fail. For example, the below code would ignore the `where()` and be equivalent to `Sport.find({ name: 'baseball' })`
```javascript
Sport.find({ name: 'baseball' }).where({name: {$ne: 'softball'}});
```
In Mongoose 5.x, the above code will correctly overwrite `'baseball'` with `{ $ne: 'softball' }`

0 comments on commit 7c2eb93

Please sign in to comment.