具体来说,我正在寻找的是嵌入式视频播放器功能,如果您只是手动共享YouTube视频但通过Graph API以编程方式完成,则会收到该功能.
例如,如果我有以下Schema(为简洁起见,大大简化).如何通过标签搜索帖子?如果嵌入了标记文档集合,我知道如何执行此操作,但我想将Tag保存在自己的集合中.
PostSchema = new Schema({
title: String
body: String
tags: [{type: Schema.ObjectId, ref: 'Tag' }]
});
TagSchema = new Schema({
name: String
});
// Here is what I've tried
Post.find({'tags.name':'javascript'})
.populate('tags') // Is it necessary to join the collections?
.run(function(err, posts) {
console.log('posts: ', posts);
});
Run Code Online (Sandbox Code Playgroud)