【发布时间】:2019-01-28 01:04:37
【问题描述】:
我正在使用 Nodejs 和 MongoDB 以及 expressjs 和 mongoose 库以及如何在另一个库之间实现 mutual用户。这是我使用的架构。
const UsersSchema = new mongoose.Schema({
username: { type: String },
email: { type: String },
date_created: { type: Date },
last_modified: { type: Date }
});
const FollowSchema = new Schema({
follower: { type: Schema.Types.ObjectId, ref: 'User', required: true },
following: { type: Schema.Types.ObjectId, ref: 'User', required: true },
date_created: { type: Date },
last_modified: { type: Date }
});
如何查询 Mongo?
【问题讨论】:
标签: mongodb mongodb-query aggregation-framework