What I suggested was to only run the method on the server
import/both/post.js
export const Post = new Mongo.Collection('post');
server/main.js
import { Post } from '/import/both/post.js';
Meteor.methods({
addPost: function (content) {
var user = Meteor.users.findOne(this.userId);
var username = user ? user.username : 'Anonymous';
Post.insert({content: content, username: username});
}
});