Category "mongoose"

TS2339: Property 'comparePassword' does not exist on type 'Model<Document, {}>'

I have defined a schema method by using this code. While I use in the service. It is showing a error. // model export interface User extends mongoose.Document

Not able to add more than 1 post request in the mongo db

i am using mongo db to fetch and post the data but unable to post more than 1 request here is my code ON posting the different values second time i am getting t

How can i get specific error messages from a Mongoose Schema?

I am trying to set up user validation in Mongoose and struggling to get the specific messages to appear. Here is my model const userSchema = new Schema({ n

How to have class-transform converting properly the _id of a mongoDb class?

I've the following mongoDb class: @Schema() export class Poker { @Transform(({ value }) => value.toString()) _id: ObjectId; @Prop() title: string;

Mongoose.js not removing object from array

I'm using Mongoose with my Discord bot and I'm making the feature where the infractions can be removed from any mentioned user(s). The infractions are saved in

Cannot create property 'ignore_whitespace' on string ' '

const Validator = require("validator"); const isEmpty = require("../validation/is-empty"); module.exports = function validateRegisterInput(data) { let errors

Vercel: Task timed out after 10.01 seconds

I recently deployed a Next.js application for a software engineering boot camp. I am using Vercel for hosting the web app. The problem I am having has been spok

Cascade Delete in mongo

I am new to MongoDB. I created 4 collections & they are connected with each other. (I am using node.js to write it) Here, it's my question. How can I dele

Invalid transport, must be an object with a log method winston mongodb logging

I want to store my error logs in mongoDB collection. I am using winston & winston -mongoDB. Getting the error: throw new Error('Invalid transport, must

The value of "offset" is out of range. It must be >= 0 && <= 17825792

You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection: RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out

Mongo Transporter PipeLine Data MisMatch Issue

I am using transporter pipeline to get sync my NoSQL DataBases between Source DataBase Mongo (Version=3.4) to Sinc Database Mongo (Version = 4.4). Here I establ

How can i upload audio file to Cloudinary with Node.js?

i deeply need help with this audio file upload to cloudinary issue I have had for several days now. I tried many times to make it work, but i am still strugglin

Nestjs Mongodb always return empty array

I am trying to create a simple nestjs project that connects to mongodb. I followed the official documentation of nestjs, but connected to my own db with "user"

Can't Connect Mongoose to MongoDB - There is no established connection with mongoose and a mongoose connection is required

I was looking around in Discord.JS and creating a bot, but every time I want to turn on the bot, ( using node index.js) this error happens: throw new Error("Th

Find by _id on an array of objects in mongodb database

I'm trying to find the id of an object inside an array of objects. That _id has the same field name _id as others in the document. This is my model (brief) var

mongoose Model.create function returns undefined

The above query returns a 200 when I try to create a User, but whenever I log into MongoDB there is no collections created. Can anyone help ? //user model co

Find balance from debit and credit entries mongodb

I have a Mongo collection like this: { "user_id" : "1", "branch_id" : "1", "trans_type":"DEBIT", "total" : 500 }, { "user_id" : "1", "b

Mongoose - Create document if not exists, otherwise, update- return document in either case

I'm looking for a way to refactor part of my code to be shorter and simpler, but I don't know Mongoose very well and I'm not sure how to proceed. I am trying t

Push items into mongo array via mongoose

Basically I have a mongodb collection called 'people' whose schema is as follows: people: { name: String, friends: [{firstName: String, lastN

Mongoose won't update new field after updating schema declaration

I just noticed that when i update my schema definition and add a field, for instance "name: String" and then try to use People.update( { _id: user_id }, { $se