比较两个值javascript node.js mongodb

首先,我有这些mongoose模式用户架构

var UserSchema = new mongoose.Schema({ username: String, email: String, password: String, types: [ { type: String, ref: "types" } ], follow: [ { type: mongoose.Schema.Types.ObjectId, ref: "follow" } ] }); 

和博客架构

  var blogSchema = new mongoose.Schema({ title: String, image: String, body: String, category: String, author: { id: { type: mongoose.Schema.Types.ObjectId, ref: "User" }, username: String }, likes: [ { type: mongoose.Schema.Types.ObjectId, ref: "likes" } ], comments: [ { type: mongoose.Schema.Types.ObjectId, ref: "Comment" } ], created: {type: Date, default: Date.now} }); 

现在我已经做到了这样user.follow和blog.author.id,以便对于一些用户有相同的ID,但事情是,我希望能够在ejs文件中显示所有具有相同ID的博客。 我已经试过了

 <% var specificBlogss = currentUser.follow.valueOf()currentUser.follow.indexOf == blog.author.id) %> <% specificBlogss.forEach(function(blog){ %> //things about the blogs <%} %>