skip to Main Content

Updating value in a nested document in mongoDB

I have the following schema: const itemsSchema = new mongoose.Schema({ name: String, checkedValue: String }); const listSchema = new mongoose.Schema({ name: String, items: [itemsSchema] }); I want to update data like this: listSchema>items>checkedValue. I have performed the following operation: db.collections.update({…

VIEW QUESTION

Why can’t JS detect a var from .env (dotenv)?

Problem: The server cannot detect process.env.PORT from my .env file, saying PORT=5000, and I have dotenv installed. process.env.port returns undefined Is something wrong? I have a very basic express server that runs fine: const express = require('express'); const path =…

VIEW QUESTION

Can’t access ‘skills’ in MongoDB?

const skillsSchema = { title: String, description: String, }; const Skill = mongoose.model('Skill', skillsSchema); const teacherSchema = { profession: String, teacherFName: String, bornDate: Number, priceperhour: Number, videolink: String, email: String, password: String, skills: [skillsSchema], }; const Teacher = mongoose.model('Teacher', teacherSchema);…

VIEW QUESTION
Back To Top
Search