skip to Main Content

Unable to update a course by its id using mongoDB and mongoose in noddejs

const mongoose = require('mongoose'); mongoose.connect("mongodb://localhost:27017/mongo-exercise") .then( ()=> console.log("Connected to MongoDB...")) .catch(err => console.error("Failed to connect to db...",err)); Below is the course schema and model const courseSchema = new mongoose.Schema({ name:String, author:String, tags:[String], date:Date, isPublished: Boolean, price:Number }); const Course =…

VIEW QUESTION

Ubuntu – Cant access Firebase Admin SDK via Node.js on my VPS, but I can on my local machine

When running this code on my VPS: import admin from 'firebase-admin' import serviceAcc from '../config/test.json' export async function fbAdminSdkTest() { try { console.log('using credentials') console.log(admin.credential.cert(serviceAcc as any)) console.log('!') admin.initializeApp({ credential: admin.credential.cert(serviceAcc as any), }) const test = await admin.auth().createUser({ email:…

VIEW QUESTION

Redis – Fastify plugin usage

I'm studying Fastify and register plugin with @fastify/redis like this app.register(redisPlugin, { client: initRedis(app.config.REDIS_INTERNAL__HOST, app.config.REDIS_INTERNAL__PASS), closeClient: true, }); And register route: import { FastifyInstance, FastifyPluginAsync } from "fastify"; import v1Routes from "./v1/index.js"; const routes: FastifyPluginAsync = async (fastify: FastifyInstance): Promise<void>…

VIEW QUESTION
Back To Top
Search