Mongoose / MongoDB schemas for blog posts and authors I'm programming a model for a blog with authors and posts. I was following this doc: Mongoose Query Population

My concern is that the createPost function is inefficient. 
Another option is to nest the posts in the Author, but how I will get all posts? Should I use MySQL? Am I doing it right? (Take a look at the functions as well)

Some more details:

Pastebin

let mongoose = require("mongoose");
let Schema = mongoose.Schema;

let PostSchema = Schema({
    title: {type: String},
    body: {type: String},
    date: {type: Date},
    tags:[{type: String}],
    _author: {type: Schema.Types.ObjectId, ref: 'author'}
});

let AuthorSchema = Schema({
    name: {type: String},
    photo: {type: String},
    bio: {type: String},
    username: {type: String, index: true},
    posts:[{type: Schema.Types.ObjectId, ref: 'post'}],
    password: {type: String}
});

let Author = mongoose.model('author', AuthorSchema);
let Post = mongoose.model('post', PostSchema);

module.exports = Author;
module.exports = Post;

module.exports.createAuthor = (newAuthor, callback)=&gt;{
    newAuthor.save(callback)
};

module.exports.createPost = (username, newPost, callback)=&gt;{
        Author.findOne({username:username}).then((author)=&gt;{
            newPost._author = author._id
            author.posts.push(newPost);
            newPost.save().then(err, auth)=&gt;{
                author.save(callback);
            };
        },(err)=&gt;{
            if(err)
            throw err;
        });
};

module.exports.getAuthorByPostTitle = (postTitle, callback)=&gt;{
        Post.findOne({title:postTitle}).populate('_author').exec((err, post)=&gt;{
            if(err)
                throw err;
            else
                return post._author;
        });
};

module.exports.getPostsByAuthorId = (authorId, callback)=&gt;{
        Post.find({_author:authorId}).exec((err, posts)=&gt;{
            if(err)
                throw err;
            else
                return posts;
        });
};
You can use the forEach function like this

const allPosts = [];

Author.find({}, function(err, users) {
    if (err) throw err;

    users.forEach(function(user) {
        const a = user.posts;
        a.forEach(us =&gt; allPosts.push(us));
    });
});


Now the allPosts array will have all the posts.