Self populating doesn't work in 6.1.8
See original GitHub issueconst historySchema = new mongoose.Schema(
{
plan: Object,
parents: [this],
isDeleted: Boolean,
isDraft: Boolean,
},
{
timestamps: true,
}
)
export default mongoose.model("history", historySchema)
Look at parents
. It worked perfectly in ^5.13.14
but not in ^6.1.8
.
I tried some ways to make it work but unfortunately without any effect.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
eNavFit User Guide - MyNavyHR
1.1 Introduction. The eNavFit interface: • Produces formal evaluation data for use in various downstream talent management processes.
Read more >Release notes for the Microsoft JDBC Driver for SQL Server
This article lists the releases of the Microsoft JDBC Driver for SQL Server. For each release version, the changes are named and described....
Read more >Hibernate ORM 6.1.6.Final User Guide - Red Hat on GitHub
Working with both Object-Oriented software and Relational Databases can be cumbersome and time-consuming. Development costs are significantly higher due to ...
Read more >Err Documentation - Errbot
Err Documentation, Release 6.1.8. Errbot is a chatbot, a daemon that connects ... __init__ on StoragePluginBase, Errbot will populate self.
Read more >Content Security Policy Level 3 - W3C
Publication as a Working Draft does not imply endorsement by W3C and its ... The sandbox directive is used to populate the CSP-derived ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@vkarpov15 Hi there, sorry for delay. Providing the script. So try to run it under
^5.13.14
and then under^6.2.2
and then compare output ofconsole.log(result)
@AndreyKomin the script as written worked by accident, and isn’t a feature that Mongoose supports. The problem is that, in your script, Mongoose 5 interpretted
[this]
to be[]
, an array of any type. The correct way to define your schema is as follows:In Mongoose 6, we also don’t fall back to using the
History
model when usingQuery.prototype.populate()
. We’ll add a note to our migration guide about this. But, in the meantime, please change howparents
is defined in your schema and that should fix this issue.