MongooseError Db while setting up database
MongooseError: The `uri` parameter to `openUri()` must be a string, got “undefined”. Make sure the first parameter to `mongoose.connect()` or `mongoose.createConnection()` is a string. at NativeConnection.createClient (C:UsersHPDesktopBookStorebackendnode_modulesmongooselibdriversnode-mongodb-nativeconnection.js:219:11) at NativeConnection.openUri (C:UsersHPDesktopBookStorebackendnode_modulesmongooselibconnection.js:823:34) at Mongoose.connect (C:UsersHPDesktopBookStorebackendnode_modulesmongooselibmongoose.js:448:15) at conn (file:///C:/Users/HP/Desktop/BookStore/backend/connection/conn.js:7:20) at file:///C:/Users/HP/Desktop/BookStore/backend/app.js:14:1 at ModuleJob.run (node:internal/modules/esm/module_job:222:25) at async ModuleLoader.import (node:internal/modules/esm/loader:323:24) at async loadESM (node:internal/process/esm_loader:28:7) at async handleMainPromise (node:internal/modules/run_main:113:12) Server is […]
Mongoose sub-schemas do not save data and have non-iterable keys
Suppose you have a mongoose schema with a sub schema
Mongoose callback query string isn’t complete in hm->query.ptr
I’m using mongoose in a simple C webserver app, on ubuntu.
MongoDB schema: optional vs. nullable
If I have a schema that includes fields that may or may not be set, what is the best way to handle these fields? Should they be optional or instead nullable?
Refactor MVC to more scalable architecture?
Months ago I began a new web project which, in the beggining, seemed like a small application with virtually few users. I began the project by using the awesome Hackathon Starter WebApp Boilerplate by Sahat because the initial requirements seemed to fit into that boilerplate. As you may expect, the project requirements have evolved since then and right now I have a large-scale SaaS application. The front end code was completely decoupled from the initial project in order to use React, and I striped out everything from the original project to leave it only as a back end REST API service. Right now, I need to implement a bunch of features and the project’s codebase seems to have become a full Bolognese Spaghetti code which I need to refactor ASAP.
type: ObjectId not displaying custom validation error message
category: { type: ObjectId, ref: “Category”, required: [true, “Recipe must belong to a category”], }, But if a category isn’t selected, the message I get is: Recipe validation failed: category: Cast to ObjectId failed for value “” (type string) at path “category” because of “BSONError” Why do I not get my custom error message? mongoose
Conditional mongoose queries
I am struggling with mongoose.
conditional where, find all if default and enums
I am struggling with mongoose.