All Questions
32,277
questions
0
votes
0
answers
16
views
Aggregate vs Populate methods when to use one in nodejs Mongose
I am creating asset managment tool for warehouse and I have Warehouse , Asset, Category models. I want to get the overall stats of each warehouse like , total assets and how many of them is active or ...
-1
votes
0
answers
8
views
Mongoose Migration Strategy: Handling Legacy Table with Virtual Fields [closed]
I'm migrating a Node.js application from Mongoose 5.9.16 to 8.2.3. My primary concern is managing a legacy table,customer_favdrinks__drinks_favoritedcustomers, that contains data related to a many-to-...
0
votes
0
answers
33
views
React / API route is unable to post the form data
I have an Add Product form. In this form, there is an Upload Image field to upload jpg and png from your computer. Anyway it doesn't work and products get uploaded without image. My aim is to convert ...
0
votes
0
answers
12
views
Mongoose Connection Not Available in Jest Tests After Using Global Setup and Teardown
I'm setting up a MongoDB container for my Jest tests using the testcontainers library and Mongoose. However, I'm encountering an issue where the MongoDB connection established in the global setup file ...
0
votes
0
answers
20
views
VersionError when saving Mongojs document in child_process
I'm doing some heavy computing in a child process so that it doesn't hang up the main thread. However, I receive the following error when trying to save a document at the end of that process: ...
1
vote
0
answers
33
views
Search products (documents) based on their ratings using mongoose
I was creating a full stack e-commerce website, when i came across this problem. I wanted to add a search filtering based on reviews star. The client sends query and minRatings to the server and the ...
0
votes
1
answer
22
views
Mongoose connection drops at all endpoints
I’ve been working on a project intermittently for some time now. Recently, after transitioning to a new computer, and router none of my endpoints respond
I’ve taken several troubleshooting steps ...
0
votes
0
answers
8
views
OverwriteModelError: Cannot overwrite AddOnsDatabase model once compiled. [Typescript]
Im using nextjs
i keep getting the error
OverwriteModelError: Cannot overwrite AddOnsDatabase model once compiled.
to fix this error i am using the OR operator to check if the model already exists
...
-1
votes
0
answers
16
views
Check if string contains any item of array in mongoose find query [duplicate]
I'm trying to find entries where the title field contains any item of an array.
Here is the relevant part of my schema:
const blogSchema = mongoose.Schema({
title: {
type: String,
required: ...
0
votes
0
answers
25
views
Switch the Database of the default mongoose connection
In trying to limit the number of connections in my web application I switched from using mongoose.createConnection() to mongoose.connect()
Which works perfectly if your only ever using one database. ...
-1
votes
1
answer
52
views
Store object array of product size and colors in mongo DB
I need to store object array of product size and colors.
Is it possible in mongo DB.(Because in ms sql it is not allowed).If so how the schema should be?.Sample object structure is shown below
{
color ...
0
votes
2
answers
29
views
How do I use the find() method to query a mongoose schema with an enum field (can hold multiple values (array)) that includes a particular value?
I have this schema:
const User = new Schema({
firstName: {
type: String,
required: true
},
lastName: {
type: String,
required: true
},
mobile: {
...
0
votes
0
answers
22
views
Have an issue with types when creating a Fastify plugin to decorate mongoose models using Zod
I have created a Fastify plugin to decorate Mongoose models, adding them to the Fastify interface:
declare module 'fastify' {
export interface FastifyInstance {
models: {
[key: ...
0
votes
0
answers
23
views
I want to reference a mongodb subdocumnent with a subdocument in the same array. I do not want to store categories in a separate document
I want to reference a mongodb subdocumnent with a subdocument in the same array. I do not want to store categories in a separate document.
const CategorySchema = new Schema(
{
name: { ...
-1
votes
0
answers
65
views
MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017
I'm having problem using mongodb. I downloaded as said in docs for debian (i'm using kali linux) and first day it was fine. Everything i did worked well. Now for second boot up it started giving me ...