Category "node.js"

Upload/Store multiple files with multer, i.e image and pdf with single request in nodejs

The following code works to upload a single image to upload an image and store its path in the database, now I can't find a way to upload an image and a pdf fil

I'm looking to get completed events counts but this query not working

My query let findEvents = await eventModel.aggregate([ { $match: { participants: { $eq: event.userId }, eventStatus: { $

Create JSON dynamically with dynamic keys and values in Express Js

I am fetching API into my Express server which has several JSON key value pairs in one array. For Example: [{ "quality": "best", "url": "https://someurlhere.e

Why has coming Application Error When I deploy code on Heroku? What is the reason of this Error?

Most of the case when I deploy in my nodejs server on heroku. I just faced this issues called Application Error. Now Question is why this error appear when we d

Ending node pipe on Transform or PassThrough

I have a stream pipe that reads, unzips, transforms, then I'd like to choose whether it moves onto a callback or writes and moves onto a callback. I hit on Pass

Which relation in MongoDB is better?

For my whole projects I have relationed my multiple collection as this. User model Name:string, email:string, password:string, vehicles:[{ "vehicleId", "vehi

ReferenceError: "_" is not defined

recipe = new Recipe(_.pick(req.body, ['name', 'tag', 'recipe'])); await recipe.save(); }); error: recipe = new Recipe(_.pick(req.body, ['name', 'tag

Socket.io and Redis Adapter same rooms and different servers

We are creating a scalable real-time collaborative text editor. The client (frontend) code is written in React.js, and the server (backend) code is Websockets (

UnhandledPromiseRejectionWarning: BSONTypeError?

I face a problem in the node.js project. error is likes, (node:9836) UnhandledPromiseRejectionWarning: BSONTypeError: Argument passed in must be a string of 12

'SyntaxError: Cannot use import statement outside a module'

I have updated by configuration to node 16.15.0 on both local machine and server. The code is running fine on local machine but on server it gives an Error - "S

Discord js 13 button edit permission channel

When a person sends my command, a channel is created that only they have access to. Also, when creating a channel, a message is sent with the "accept" button, w

Pipedream, getting trigger event data with sync function

i'm wondering hot to get pipedream to do an nodejs action, but i need to use the trigger event (HTTP POST) to get some info, the thing is that i cant wonder how

Populate Failed immediately a ref was indexed in Mongodb via Mongoose Schema

I had a Post Model with a ref as below const mongoose = require("mongoose"); const PostSchema = new mongoose.Schema( { _id: mongoose.Schema.Types.O

Metro has encountered an error: While trying to resolve module `@apollo/client`

I am trying to install GraphQL into my React Native app and in doing so, I was given this error message. I have confirmed that the file actually exists and have

Can't install nodejs in Termux on Android

When I do pkg install nodejs or pkg install nodejs-lts it gives me a this message: Checking availability of current mirror: ok Ign:1 https://dl.bintray.com/gri

Cannot access to WSL2 port opened via IPv6 from Windows host

I have a node-server running at WSL2 Ubuntu-20.04. netstat -tulpn in WSL shows the following ports: The ports specified as 0.0.0.0:8080 can be accessed in both

Setting a title and favicon for non-html files on a website

Is there a way to set a title and favicon for non-html files on a website? For example, a link like https://example.com/files/image-or-something.png. By default

pm2 can't find package.json when start

I try to start my app on VPS.I can start my app in terminal, but when I work with pm2 , I get the error 0|gentle-s | Error: Cannot find module '/root/my-app/ind

npm: Replacing one package from dependencies with a fork (possibly using git)

I'm using terser, which requires esprima. Esprima has been abandoned, so I'd like to replace it with the fork esprima-next. However, no method which I've used t

Would like to write a javascript that helps me to find documents in a folder

I would like to write a js for an offline website (located on a local Windows server or any other server). It's supposed to look for files like PDFs in several