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 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...
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 such models:  const UserSchema = new mongoose.Schema({   name: String,   workspaces: [     {       workspace: {         type: mongoose.Schema.ObjectId,       },       owner: Boolean     }   ] });  const WorkspaceSchema = new mongoose.Schema({...
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...
I want to retrieve article submmited by member in recent order based on time. Member Schema having array of _id of submitted article. Below are the Schema of Member and Article -   Member Schama      const mongoose = require('mongoose');...
I have a very simple one to many relationship where a User has a list of Alerts. For this, I've defined the following schemas:  var userSchema = new Schema({     email: String,     alerts: [{type: Schema.Types.ObjectId, ref: 'Alert'}] });...
I have 3 collections :  events :  {    _id: ObjectId(54ca0f2506d0c6b673b2fde8),    _reference: ObjectId("54fd786c549e96f70f9c027d") }, {    _id: ObjectId(54acd81941a646d768922cfa),    _reference: ObjectId("54fd786c549e96f70f9c027d") }...
I have the following Object in mongo:   "object":[     {"_id":"objectId",     "options":[         {"_id":"optionId1",         "field1":"data1"         "isAnswer":false},{//same},...
I have a MongoDB with the following two schmemas:   Survey: {     "_id": {         "$oid": "5e4ed11c73c4c900ef824b8a"     },     "isRunning": false,     "title": "TestSurvey",     "dateOfCreation...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.