Category "node.js"

How to insert array to object using postman and nodejs. Send the data to mongodb

I Write My code like this but it has error, How to rewrite this code db.collection('collection_name').insertOne({ name:req.body.name, details:[{ age:req.body.ag

Error message : MongoServerError: bad auth :Authentication failed

What is the reason behind this error? this code I am using to connect to DB. const uri =`mongodb+srv://${process.env.DB_USER}:${process.env.DB_PASSWORD}@cluster

The provided value is not of type '(ArrayBuffer or ArrayBufferView)' when it is

I convert to ArrayBuffer using the function base64ToArrayBuffer but I'm getting an error that says it's not ArrayBuffer and the key is the type of CryptoKey. I

In Mongo, If a document I'm saving "Prateek" then I don't want on the next create operation even the "prateek" or "praTEEK", etc is saved

//** If I'm adding a new document with the name: "India", then I don't want that the DB allow another name with the name: "INDIA", "india", "indIA", etc. I'm ne

How to render JSON output from an API on the same webpage in which the user gives the input , preferably in a Div container in Express JS?

So here, I am using NodeJS with Express Js. I have stored the JSON value from an API in a variable and I am trying to show the JSON output on my HTML page, I a

Resolving 'Illegal-mix-of-collations' MYSQL error in node

I am connecting to a mysql database from node using mysql2 and have been experiencing intermittent illegal-mix-of-collations errors - see this question. The col

how to add digital signature to hash data in node js use .cer file?

I'm new to digital signatures and how to use them, so I can't complete my task. Sign the hash with the CADES-BES signature. Insert a new element with a Base64

How to get mongo documents created in the last 24 hours using mongoose?

I have this mongoose schema const PictureSchema = mongoose.Schema({ user: { type: mongoose.Schema.Types.ObjectId, ref: 'User', requi

Net to setup simple if and else statement in node.js

trying to setup node.js code i want to setup simple if and else can anyone help to setup if and else // To use any npm package on Pipedream, just import it i

Why does my Discord bot keep repeating when it runs this command?

This is the code used, there is nothing (I think) that's causing it to repeat, matter of fact I added something so it stops repeating but it didn't do anything

i am trying to run the node of ganache but getting this error

I am trying to run the node of ganache but getting this error.please resolve my problem.

jwt.verify not throwing error for expired tokens

I'm using JWT - jsonwebtokens in Nodejs. I'm creating a token and want to throw an error if the token expires. My token is created successfully and I'm checking

npm install --timing not saving full debug log

I'm running npm install --timing, and when it completes it will output something like: npm ERR! A complete log of this run can be found in: npm ERR! /Users/

Why there is this "ip" field in a bittorrent dht querying response?

I was debugging this dht implementation when I came across this query response (KRPC type r). Theres no documentation about an "ip" field in BEP5, so why is thi

Extract Color Matrices Used by Filter?

I am trying to detect the color matrix applied to a filtered image so that I can apply a reasonably close approximation of the filter using fabric. Does anyone

MongoDB atlas connection error with nodejs

enter image description here This error is showing when I connect the MongoDB now how can I solve it

How To Mock a Dependency Class in Typescript Node Using Chai-Spies

Given something like my-module.ts that will be called by an external consumer that of course cannot do dependency injection to this module's constructor: import

Error creating json file in node js

I have followed many solutions provided in the previous questions but mine is not working. The problem is in .json extension. Whenever I use filename.json, the

What's the codes such as [?2004l means in SSH result?

Got such result when using ssh2 in electron: [?2004l [?1h= [1;24r[m[m[0m[H[J[2;1H[1m~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~[0m[24;63H0,0-1[9CAll[6;32HVIM -

Unable to publish scoped NPM package on internal Artifactory

i am trying to publish a simple (there is only a js file inside) scoped NPM package on my company's Artifactory. I followed all the documentation available both