Skip to main content
Filter by
Sorted by
Tagged with
2 votes
1 answer
85 views

I'm trying to implement a robust search function in my NestJS/Mongoose application that can handle partial matches while being case-insensitive and diacritics-insensitive (ignoring accents). My ...
Steeven Delucis's user avatar
3 votes
1 answer
59 views

exports.getAllProducts = async (req, res) => { try { console.log(req.query); const queryObj = { ...req.query }; const excludedFilters = ["page", "limit", "...
ahmad fakher's user avatar
0 votes
1 answer
57 views

Take the following Mongoose schema. const userSchema = mongoose.Schema({ username: { type: String, required: true, unique: true, minLength: 3 }, name: ...
Ahmad's user avatar
  • 10
0 votes
0 answers
16 views

//User Schema const userSchema = new mongoose.Schema({ name: String, email: String }); userSchema.virtual('posts', { ref: 'Post', localField: '_id', foreignField: 'author' }); //Controller ...
Dipak Halkude's user avatar
2 votes
1 answer
80 views

I am new to programming (and NextJS) and I'm building a NextJS app, using Mongoose for my MongoDb connection. I was wondering if I should close the connection after each query? Right now I am just ...
Alex's user avatar
  • 13
0 votes
1 answer
53 views

i have some problems in production using mongo We have python using mongo and mongo-express for ui. And we are facing performance issues, after research i found db.currentOp() to see queries which are ...
Zesshi's user avatar
  • 524
0 votes
0 answers
22 views

I have these two schemas with discriminator. It's custom activity that also has fill in the gaps questions which is another schema. For some reason when I use findByIdAndUpdate, it updates all the ...
FouLiNuX's user avatar
0 votes
1 answer
67 views

I am trying to solve an issue with the format of documents in a MongoDB depicted below. { "_id": { "$oid": "68dc4f78e11553b3647231e2" }, "name": "...
Cade Bray's user avatar
  • 101
0 votes
1 answer
42 views

While defining the model, discriminators are created on the basis of the SchemaVersion. On export, the already created discriminator model is returned to prevent the overwrite errors from mongoose ...
nischalmainali21's user avatar
0 votes
1 answer
54 views

When I execute the following code in my application: const freelancer = await Freelancer.findOne( { _id, 'experiences.title': 'Frontend Javascript developer' }, { 'experiences.$': 1 } ); console....
Raphael's user avatar
  • 767
0 votes
0 answers
69 views

I am working on migrating the project to a new version. Stack: express 5, mongoose 8, typescript 5.8, typegoose 12 I looked for more information and would now like to clarify the cause of the problem:...
Roman Nozhenko's user avatar
0 votes
0 answers
72 views

Hopefully this makes sense. Using mongoose to push new items into an array of subdocuments, the documents get added fine, however on certain (random) occasions, the createdAt date of the current ...
Stephen Clark's user avatar
2 votes
1 answer
99 views

I would like to know how to use @Virtual from nestjs/mongoose to calculate a local field with fields from another schema (like a classic mongoose populate)? I have this InvoiceHub schema that ...
Steeven Delucis's user avatar
0 votes
1 answer
50 views

I have a mongoose schema where I defined a text index like this: FreelancerSchema.index({ title: 'text', presentationText: 'text' }, { weights: { title: 2, presentationText: 1 } }); I try to search ...
Raphael's user avatar
  • 767
2 votes
0 answers
137 views

Mongoose connection to MongoDB Atlas fails with queryTxt ETIMEOUT I’m trying to connect my Node.js app to MongoDB Atlas using Mongoose, but the connection fails with a timeout error. Here’s the error ...
Kevin L's user avatar
  • 21
1 vote
0 answers
46 views

I’m building a financial backend in Node.js/Express that serves bond yield differentials for two countries at minute granularity. Each country+bond maturity pair is stored in MongoDB as a single ...
ivanbosk's user avatar
0 votes
0 answers
114 views

I'm making an event management application. I'm using better-auth & mongodb. I got a form in which I can create an event. Now, alongside the event name, and dates I want to pass along the owner's ...
Potion's user avatar
  • 13
0 votes
0 answers
79 views

I'm deploying a Node.js backend using Mongoose, and I'm getting the following error during build on Vercel: Error: Cannot find module './bulkWriteResult' Require stack: - /vercel/path0/backend/...
Akash Mishra's user avatar
1 vote
1 answer
54 views

I'm implementing a date filter feature that allows users to filter results using from and to date parameters. The filtering works correctly for some date ranges but returns unexpected/incorrect data ...
Stykgwar's user avatar
  • 795
2 votes
3 answers
105 views

I’m working on a Node.js app with MongoDB (using Mongoose), and I’m trying to set or update a statusUpdatedTime field in a document. But when I check the document after the update, the field is either ...
K. Hanumann's user avatar
0 votes
0 answers
83 views

I seem to be unable to access or update an array in a document using mongoose. here's my setup: type DemoSchema = { strings: string[] } const DemoSchema = new Schema<DemoSchema>({ ...
Sebastian Siverand's user avatar
0 votes
1 answer
58 views

I use MongoDB for my database and use {strict: "throw"} to throw an error with invalid data. When I save a new instance with a field that is missing from the schema, I get an error. But when ...
ginjaemocoes's user avatar
  • 4,662
1 vote
1 answer
53 views

I have a Mongoose schema with NestJS: @Schema({ versionKey: false, id: false, collection: "basics", timestamps: false, toJSON: { virtuals: true, }, toObject: { virtuals:...
Richard H. Nguyen's user avatar
0 votes
1 answer
77 views

I'm new to back-end development. I'm doing the FCC back-end challenge, and I'm having a problem because they're asking me to return an array in a GET request that contains all the existing users. But ...
mario huertas's user avatar
0 votes
1 answer
59 views

MongoDB Operation Timeout Error: products.find() buffering timed out after 10000ms Problem I'm getting a timeout error when trying to fetch products from my MongoDB database using Mongoose in my ...
Dewashish Sahu's user avatar
2 votes
1 answer
42 views

I'm running into a strange issue when updating a Mongoose document. I'm trying to update a field (paymentType) inside an array of subdocuments (students) in a Teacher document. Both console.log(...
N4N1T0's user avatar
  • 76
0 votes
0 answers
43 views

I was working on Nextjs BLOG project, built api's then deployed it in Vercel post, get all, and delete seem to work. But get indivisual post to view and put method for editing don't work, (dynamic ...
Isru_Crasus's user avatar
1 vote
0 answers
56 views

I want to override the default Mongoose cast error message when a value is not a string. I have a field firstName defined like this: @Prop({ type: String, required: [true, 'firstName is required'],...
Steeven Delucis's user avatar
0 votes
1 answer
69 views

I am trying to define a toJSON function in my schema so that it will remove __v and replace _id as id and remove pwd from the document as well when .toJSON is called. import { model, Schema } from &...
suyog's user avatar
  • 159
-1 votes
1 answer
80 views

I'm building a MERN stack app and trying to start my backend server using Node.js. I run: node Backend/server.js But nothing happens ,there's no output in the terminal at all (no success messages, no ...
Aditya Hegde's user avatar
0 votes
1 answer
78 views

I am trying to upgrade my express code from using Mongoose version 5.13.7 to 8.15.1 and I am not able to authenticate to my Mongo database anymore. The code that used to work: mongoose.connect("...
One Guy Hacking's user avatar
1 vote
0 answers
64 views

Whenever I run this JS using Node, I first get a console.log() back saying the database is connected. However, I get an error message afterwards saying: MongooseError: Operation campgrounds....
andrew shin's user avatar
0 votes
0 answers
70 views

A of class="active" is added based on what star I click on. With schema, how do I connect it to the db, creating a default 1 star to every post? Tried to do it with "score:" but ...
UncleNoob's user avatar
0 votes
1 answer
85 views

So I have some models in my MongoDB database, which details I am trying to fetch via Mongoose in NextJS, everything works in development but in production the data is not being fetched. I have been ...
Venusai's user avatar
  • 13
0 votes
0 answers
18 views

Body: I'm working with Express.js, and I'm trying to add a status property to req.query in middleware, but it remains empty. Here’s my code: Route: router.get( "/published", faqController....
sherryyy's user avatar
1 vote
1 answer
41 views

I'm using Mongo DB for my database and I'm using mongoose for managing it in my backend code. I have 3 models in this details. the first model is Media for getting files form users. the second is ...
kotroid's user avatar
  • 13
0 votes
0 answers
738 views

I am trying to implement better auth for user signin and signout in nextjs as well as expo router. I keep running in the error: ERROR [Better Auth]: User not found. Other tutorials I have seen online ...
Ridwan Ibraheem's user avatar
0 votes
0 answers
78 views

I am using mongoose to connect db in express, While in production app is running on, sometimes in the time of performing query on db mongoose unable to connect database and through connection timedout ...
kumol's user avatar
  • 184
0 votes
1 answer
64 views

I have the following function: export const findCustomer = async (query?: FindCustomerParams) => { try { await database.connect(); } catch (err: any) { throw new Error("Could not ...
Ethan's user avatar
  • 1,868
1 vote
0 answers
60 views

I'm working on a Mongoose setup where I have an Employee schema that includes fields like name, employeeId, departmentId, and designationId. Recently, I manually added a new field photo to a document ...
Dark_Shadow's user avatar
0 votes
0 answers
42 views

I've been trying to create a plugin which implements a query and schema method that populates a user field and selects some inner fields from it (firstName, lastName, image). I just can't seem to make ...
עופרי קרביץ's user avatar
3 votes
0 answers
60 views

I'm new to express and I'm using Mongoose with TypeScript and ran into a typing inconsistency that I can't wrap my head around. I have a custom interface IVoyageLeg that extends Document, and I'm ...
Nouira Firas's user avatar
0 votes
2 answers
60 views

while starting from mongod.conf using below entry mongod not running throwing error: mongod.service : main process exited, code=exited, status=2/INVALIDARGUMENT IN MONGD.CONF: when commenting ...
prat_86's user avatar
  • 91
1 vote
0 answers
59 views

I'm trying to create a nest Schema for mongoose that uses typescript's generic types. The goal here is to restrict my database with a few types (everything will be validated with Joi or equivalent, ...
Krigan's user avatar
  • 41
0 votes
0 answers
50 views

I want to create a middleware function to check if the document_Id exists and it's not wrong using Model.exist({_id: id}) or such a query, so the API throws an error. However, the problem is my models/...
Marya's user avatar
  • 198
0 votes
0 answers
70 views

config-suggestion.js const { SlashCommandBuilder, ChatInputCommandInteraction, ChannelType } = require('discord.js'); const GuildConfiguration = require('../../models/GuildConfiguration'); module....
Bugkung1412's user avatar
2 votes
1 answer
196 views

I’m using [email protected] with [email protected]. I’m trying to use the create() method in Mongoose along with a session for transaction support. However, when I try to insert multiple documents, I get ...
Leo_code's user avatar
0 votes
0 answers
44 views

I've got this code for updating the match which will also update the other 3 models player team and tournament the code goes like this const updateMatch = async (req, res) => { try { const { ...
Santosh Jugjali's user avatar
1 vote
2 answers
99 views

I inserted a client in my "clients" collection. data inserted { "type": "private", "name": "Client 1", "contact": { &...
Steeven Delucis's user avatar
0 votes
1 answer
72 views

I have a NextJs app built with mongodb database. I was surprised to see that I quickly almost reached the threshhold of maximum connections: This app used to be built with node and react and this was ...
Ahmed Ghrib's user avatar

1
2 3 4 5
934