Can you populate an array in a mongoose schema with references to a few different schema options?  To clarify the question a bit, say I have the following schemas:  var scenarioSchema = Schema({   _id     : Number,   name    : String,   guns : [] });...
I can see the populated value in the console but when trying to access it I'm getting undefined:    const AccountProfile = new Schema({   owner: { type: String },   firstName: { type: String },   lastName: { type: String },   countryId: { type: m...
I have created an api with nodejs, mongodb/mongoose and express, to make CRUD request to interact with json data, more specifically, with two mongodb collections (1: datas 2: produits).  The "datas" collection is bind to an "User" sch...
I am building an app and I have create 2 models.     const UserSchema = new Schema({     _id: Schema.Types.ObjectId,     account:{       type: String,       unique: true     },      email: String,     first_name: String,     last_name: String }    co...
I am trying to populate my users car inventory. All the cars have a userId attached to them when they are created but when I go to populate the inventory it doesn't work and I get no errors.  Here are my models:  User.js  let UserSchema = mongoos...
This is an example of what I am trying to do, retrieve all the post inside a mongo db, for each of the post populate the author then use author object to retrieve the profile picture from Cloudinary.   What is the correct way to go about doing this?...
I have a mongodb database and   I use mongoose with nodejs.  I need return data from the next query populating "tabela_tuss" only if I have the field "temtussvinculado=true".  Here is what I am doing:  ConvProced.find({'convenioId...
I have such models:  const UserSchema = new mongoose.Schema({   name: String,   workspaces: [     {       workspace: {         type: mongoose.Schema.ObjectId,       },       owner: Boolean     }   ] });  const WorkspaceSchema = new mongoose.Schema({...
I have a trouble with populate deep level. I searched and read many pages but it can't resolve.   Here is my Schema:  var boxSchema = new mongoose.Schema({     name: {         type: String,         unique: true     }//, required: true     , heigh...
All, I am writing a post function that has includes a for loop with three nested mongoose functions (findOne, findById & create). However, it appears as if the functions are not being completed before moving on to the next "i".  This is e...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.