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
12 views

I can't import my User model on my new service files, it says undefined

I have an express.js application. It contains several models and the User model is one of them. When I tried to import the User model in my new service files, I got 'TypeError: Cannot read properties ...
kuraidesu's user avatar
0 votes
0 answers
15 views

issue with connecting mongodb through mongoosejs

so I'm using this type of code to connect to mongodb - github link to code const mongoose = require('mongoose') cosnt s = "my connection url" mongoose.Promise = global.Promise ...
Xx-Mohit-xX's user avatar
0 votes
1 answer
18 views

Mongodb aggregate multiple collections super slow

New to Mongo so bare with me, but cannot figure out best (fast) solution. I have three different collections: Shipments, Tracking, Messages I'm trying to join two simple fields from the Tracking and ...
Stephen Clark's user avatar
0 votes
0 answers
16 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
0 answers
20 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
1 answer
40 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
  • 25
-1 votes
1 answer
34 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
27 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
53 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

15 30 50 per page
1
2 3 4 5
3127