Skip to main content

Questions tagged [mongoose]

Mongoose is a MongoDB object modeling tool, or ODM (Object Document Mapper), written in JavaScript and designed to work in an asynchronous environment.

0 votes
0 answers
3 views

how to re-validate the only card that a change has been made to it without reloading/revalidate the whole page

I have this component that renders <CardsList/> which is a <ul> and inside it I'm rendering many of <li> called <BeanCard/>: import { getBeans } from "@/API/apiBeans";...
Marya's user avatar
  • 119
0 votes
1 answer
9 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. ...
TheReezen's user avatar
-1 votes
0 answers
12 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 ...
yasith's user avatar
  • 17
-1 votes
1 answer
32 views

How to remove data from mongo dab using $pull operator

i am new in the field mern stack and i want your help to remove to remove comment from User data which is equal to Post data comment Post Data: { _id: new ObjectId('66985b5774dd3a87fd1be9d4'), ...
GAMING WARRIOR's user avatar
0 votes
0 answers
24 views

Scaling mongodb for a social media feed

Are there limitations to how much mongodb can scale when it comes to querying millions of documents. I'm designing a social site, similar to twitter where users will have a chronological feed of posts....
John Scipion's user avatar
0 votes
2 answers
19 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: { ...
Textbook's user avatar
  • 119
0 votes
1 answer
52 views

Query MongoDB documents for a particular date range [duplicate]

I am trying to query documents based on particular date range. So I need all the documents where the createdDate is less than equal to current date and greater than equal to currentDate - 2. I am ...
Nikhil Bansal's user avatar
-1 votes
0 answers
55 views

Mongoose doesn't create new document [closed]

I'm trying to create a new document. This is the function in the API router (using express.js) mongoose .connect('mongodb://localhost:27017/name') .then(() => { console.log('Connected to DB ...
idobarabi's user avatar
0 votes
1 answer
34 views

Is there a way to change a field from an array to a single element in a mongodb query

I am trying to query my DB on a collection but I have some field that I would like to change from an array of objects to a single object that have been picked up randomly from the array. is this ...
Magnus's user avatar
  • 3
-1 votes
0 answers
25 views

while using mongodb with express, delete route is not working? [closed]

I am using Mongodb with express and creating a simple chat program . while creating a delete route i am not able to render a form to confirm password and it didn't even response console.log(id); // ...
Arpit Saraswat's user avatar
0 votes
0 answers
35 views

want to create an archived section based on the expiry date

There are couple of listings and they have an end date set with them . I actually wanted to create a seperate route for the archived section, so basically whichever listing crosses the end date they ...
khonshu's user avatar
  • 21
1 vote
0 answers
25 views

How to deal with _id when sending arrays of Mongoose Data from a Server Component to Client Component in NextJS?

I'm using NextJS 15.0.0-rc.0, Mongoose 8.4.1, and React 19.0.0-rc-3563387fe3-20240621. If you just attempt to send data from a server component to the client with even something simple like the below, ...
Merlin -they-them-'s user avatar
0 votes
0 answers
15 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: ...
Gihan Rangana's user avatar
0 votes
0 answers
21 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: { ...
gichuru's user avatar
  • 31
-1 votes
0 answers
55 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 ...
Lobiani1's user avatar

15 30 50 per page
1
2 3 4 5
3127