mongoose-populate

    2热度

    1回答

    是否有可能使用猫鼬同时填充多个路径?我试图做这样的事情: User.findById(_id) .populate({ path:'friendIds', model:'User', populate: { path: 'reviewIds', model: 'Review', populate: [{ pat

    0热度

    2回答

    我正试图围绕Mongoose Populate语法和结构进行打包。我有两个模式。 父有一个子引用的数组。 const Parent = new Schema({ name: String, children: [{type: Schema.ObjectId, ref: 'Child'}] }); const Child = new Schema({ name:

    0热度

    1回答

    我是Mongoose和Nodejs开发的新手,我对如何正确设置保存我的记录有点困惑。这里是我的两个模式: 下载 var mongoose = require("mongoose"); var Schema = mongoose.Schema; var downloadSchema = Schema({ title : String, description : Stri

    0热度

    1回答

    一组我有这个在我的猫鼬架构...一些组... 'use strict'; var mongoose = require('mongoose') , Schema = mongoose.Schema; var clientSchema = new mongoose.Schema({ name : { type: String }, offerings

    4热度

    1回答

    我正在使用该项目的MongooseDeepPopulate包。我有SchemaA,SchemaB,SchemaC,SchemaD。我的SchemaD,SchemaC连接到SchemaB,SchemaB连接到SchemaA。 我已经这样做了。 var deepPopulate = require('mongoose-deep-populate')(mongoose); AlbumSong.plug

    0热度

    1回答

    我在自己的代码中遇到了这个问题。我复制了Mongoose Query Population示例中的代码,看看我做错了什么。但我也有与他们的代码相同的问题。 问题是有关日志中exec回调: console.log('The creator is %s', story._creator.name); ^ TypeError: Cannot read property '_c

    0热度

    1回答

    var posting = new Posting({ content: fields.content, creator: req.user, }); posting.save(function(err) { if(err) { res.status(501).json({ error: err }); } else { res.j

    1热度

    1回答

    我有一个模型A机智这个领域: var field = { foo: String, b: [{ type: Schema.Types.ObjectId, ref: 'B' }] } 和型号B这种精密组件这 - A.find({_id:req.params.id}) .populate({ path: 'patient', model: Patient,

    0热度

    1回答

    我试图populate Mongoose模式内的一个属性,该属性引用另一个外部模型/模式中的属性。 我能得到猫鼬人口/引用工作时,两个模型/架构和查询都在同一个文件,但我有我的架构设定这样的车型都在自己的文件/模型内目录中,而/models/index.js将返回的模型对象(显然index.js知道要排除自身) 我运行到这个问题,是因为该架构/模型是都在他们自己的文件中,当我指定模型名称作为参考时

    0热度

    1回答

    猫鼬填充效果很好。但是,有人可能使用填充来拉取另一个不属于_Id的属性的文档吗? 对于实施例注释架构: var CommentSchema = new Schema({ _id:Auto Generated postId:1, userId:411, comment:'This is a comment', // Would want to fet