Category "mongoose"

Mongoose calculating average from another collection

I am new to MongoDB/Mongoose. I am trying to do a search based on a key string for a 'Resource' which will return a list of resources based on average of rating

Mongoose - find object and delete objeto inside array

I have this document : [ { "_id": "626c5fd2aa0fc0e4eef45c94", "productos": [ { "_id": "626d50b621180e291a330333"

Aws documentdb MongoServerError: Authorization failure while connecting using mongoose

error: [nodemon] starting `node server.js` app listening on port: 5600 /home/ubuntu/cnox-webbackend/node_modules/mongodb/lib/cmap/connection.js:203

Document Read and insert with locking/transaction in nodejs with mongodb

In reservation system, only 5 different user can create bookings. If 100 user call booking api at same time than how to handle concurrency with locking. I am us

Querying with mongoose: how to parce a Mongo _id?

I found this similar question to mine, but without explanation Mongoose find query vs $match, I'm trying to do something similar. I manage to filter by today's

Mongoose - array of enum strings

I have a Schema that has a property with the type of array of strings that are predefined. This is what I've tried to do: interests: { type: [String], e

How can Add two different field which type is ObjectId in same object which refer same schema

const ChatSchema = new mongoose.Schema({ username: { type: String, }, mobile: { type: Number, }, friends: [ { type: mongoose.Schema.

Getting no overload matches this call running mongoose with typescript and express

I am getting the below error for useNewUrlParser, useUnifiedTopology, useCreateIndex: No overload matches this call. Overload 1 of 3, '(uri: string, callback:

Connecting to mongoDB(/mongoose) from a website?

I'm creating a website, and currently for a feature I need it to connect to my mongoDB database, is there any way to do this? As far as I've seen it's not possi

Mongoose Error: "useCreateIndex" is not supported but documentation still has it

This is frustrating. No clues why I got this error while documentation still has it. Please help! My code to connect MongoDB with mongoose. const mongoose = req

Can't get Data while fetching from React Error(304)

While i'm using axios to fetch data it's return 304 on React . But it's work on Postman ! const [mangas, setMangas] = useState([]) useEffect

Property 'create' does not exist on type { new (fileBits: BlobPart[], fileName: string, options?: FilePropertyBag | undefined):File; prototype: File}

I'm trying to create a file-sharing app using Multer, Cloudinary, Typescript, and Mongoose. When I'm trying to save the files uploaded by users and the data lik

Use Schema inside another Schema not working. Error: CastError: Cast to [ObjectId] failed for value

What I'm trying to achieve: Use one Schema (Ingredient Schema) inside another one (Recipe Schema). My goal is that in the Recipe Schema, my ingredients key to b

Remove specific object from array during aggregation

I have documents with the following structure: {field: ["id1", "id3"]}, {field: ["id2", "id1"]} To query the documents I use aggregate({$match: {'field' : { $i

login with email or phone or username in node js

How can I login email or phone or username with password in node js and mongodb? user can login with email and password, username and password, phone and passwo

grammar & spell checking in nodejs

How to check spelling mistakes, grammar & punctuation errors, use of greetings & short keywords and total time to complete each single chat session in s

Mongodb insert null date

Mail Schema: var mail = new mongoose.Schema({ globalId: {type: String, index: true, unique: true}, from: {type: String, required: true}, beginDate:

Javascript await / promise order of execution is not as expected

In my Nodejs project I would just like to await a mongoose.save function before continuing with my code. The below example does not work, but can anyone help me

ERR_HTTP_HEADERS_SENT: Cannot set headers after they are sent to the client

I'm facing this weird issue in NodeJS when using with Passport.js, Express and Mongoose. Basically, I get an error saying "Cannot set headers after they are sen

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