I started using mongoose-autopopulate, as I've been annoyed of manually typing the populate paths. I developed a service which stores post in a mongodb database and links to an user id stored, used for authentication too. Everything works fine, but when I try to add a comment to a post linked to an user account, too, the user in the comment is not populated (I'll get null). I had a look in my database and everything works correctly, the database is storing the right links.
I started using mongoose-autopopulate, as I've been annoyed of manually typing the populate paths. I developed a service which stores post in a mongodb database and links to an user id stored, used for authentication too. Everything works fine, but when I try to add a comment to a post linked to an user account, too, the user in the comment is not populated (I'll get null). I had a look in my database and everything works correctly, the database is storing the right links.
My query that returns the populated post
Database
My post
My comment
And my user.
As you can see, everything is alright in the database itself, but when I use the query with mongoose using these schemas
Schemas
Post.js
User.js
Comment.js
I'll get
The reference to the user is null, I don't have any idea if I do something wrong or if this is a bug. Please tell me if I did something wrong. Kjell