【问题标题】:How do I pass an object element in express using Mongo?如何使用 Mongo 在 express 中传递对象元素?
【发布时间】:2018-07-11 01:25:28
【问题描述】:

我想从 ejs 模板传递整个对象

例如:

var 架构 = ... { 名称:[{

}] }

【问题讨论】:

  • 如果您在问题中填写一些详细信息和代码,这将非常有帮助。不清楚你在问什么。

标签: node.js ejs


【解决方案1】:

有了这个你可以实现它,希望这就是你的要求......

  notifications: {
    notifiId: {type: Schema.Types.ObjectId, ref: 'Notifications' },
    viewed: { type: Number, default: 0 }
  },

并找到它:

model_Variable.findById(req.params.id).populate("notifiId").exec(function (err, 
callBack) {});

来源:How to populate in this case Mongoose

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-04-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-11
    • 2016-10-18
    • 1970-01-01
    相关资源
    最近更新 更多