Category "mongoose"

findOneAndUpdate is not a function of mongoose

I know this question has been answered before but I can't seem to implement the changes into what im working with. I'm trying to create a daily command that rew

How can I solve this problem with mongoose connection?

This code worked for a while and I don't know what I did but it gives me this error. I saw a some guys said that update the Node, but it doesn't work for me. Mi

Get trending groups using mongodb aggregation

I have two collections, Group and GroupChat. A group has a chatroom respectively. // group.model { name: string, desc: string } // group.chat.model { group:

Subdocument not being saved in its own collection - Mongoose

I found this on the documentation for mongoose: Subdocuments have save and validate middleware just like top-level documents. Calling save() on the parent docu

Delete object from inner schema in mongoose?

How do I delete object from inner schema in mongoose? I try to delete comments from the Holiday Schema, this is the holiday schema: const holidaySchema = new mo

Increment value in update query mongoDB

I am trying to add two values in a mongoose function. This the function im using: Equipa.findOne({ '_id': req.params.equipaID }, function (error, equipa) {

node.js moongose find populate cant access to array

I have this in my backend: ad = await Ad.find({'company': companyId}).populate('creator'); And when i console.log(ad) i get this: [ { connections: [],

mongoose | batch insert and update if already exists

I have the following Schema const domain = new Schema({ created: { type: Date, default: Date.now }, last_update: { type: Date, default: Date.now }, do

mongoose | batch insert and update if already exists

I have the following Schema const domain = new Schema({ created: { type: Date, default: Date.now }, last_update: { type: Date, default: Date.now }, do

MongoDB Atlas very slow connection on hot reload

I have been working on a React application that would connect to MongoDB Atlas with Mongoose. Using nodemon and webpack for hot reloading it would reconnect to

MongoDB indexes are ignored inside the $facet pipeline

I have all combination of compound indexes for this collection. The aggregattion query i used is: db.products.aggregate( [ { $facet: { "categ

Mongoose 5.11.11 SchemaDefinition Typing

Mongoose recently updated to accept a model generic it works well with a string type but not with a boolean type. Type 'boolean' is not assignable to type 'Sche

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