Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
-4 votes
0 answers
87 views

array?.map (if array is undefined) [closed]

const arr = [{ component_name: 'apple', component_part: [{ part_no: 1, part_name: 'xxx' }, { part_no: 2, part_name: 'yyy' } ] }, { ...
BdPk's user avatar
  • 33
0 votes
1 answer
38 views

How to access elements of Array

I am trying to access an element in the following json response from an API call via foilResponse.data.products.edges[0].totalInventory however no matter what variation of the above I use everything ...
Isaac Copenhaver's user avatar
-5 votes
2 answers
90 views

How can I sort an array?

I have a backend in node.js, where I generate this array - let allItems = Array.from({ length: 1_000_000 }, (_, index) => ({ id: index + 1, title: `Title ${index + 1}`, isSelected: false, }));...
IJustStartedLearningCode's user avatar
0 votes
0 answers
45 views

Get the specific value from array list based on the key value in Javascript [duplicate]

I have an array of below type, [{ "type":"G", "amount":"123", "penamount":"110" },{ "type":"N", "amount&...
H Varma's user avatar
  • 650
0 votes
0 answers
46 views

How to Optimize Bulk Insertion in MongoDB for Event Schedules Without Nested Loops?

I'm developing a Node.js application that requires adding event schedules into a MongoDB database. Currently, my implementation utilizes nested loops to create these event entries, which may lead to ...
Vikas Chauhan's user avatar
-2 votes
1 answer
118 views

FlatMap vs Reduce for extracting data from a nested object

I have a dataset as such, where there may be multiple testResults array elements, along with there being 1 or many response array elements; and I an wanting to extract all of the potential ...
physicsboy's user avatar
  • 6,348
0 votes
1 answer
60 views

Pending promise stored as property in object array, do not know how to access to fulfill

I'm trying to fill an array of objects with specific property values and am using Promises with async/await with Javascript in a Node.JS environment. Here is the main part: getPublicNotes(...
PatW's user avatar
  • 27
0 votes
1 answer
60 views

How To Find The Closest Value In An Array?

I have made a Node.js server which pulls data from an API every second and stores it if there is a change in the data. The "data" of the site is an object which also has the timestamp of ...
Dhruva Kalur's user avatar
-1 votes
1 answer
43 views

Get Index of Sub Array in MongoDB

I have the following array: const universitiesSchema = new Schema({ name: { type: String, required: [true, 'Required'] }, users: { type:[Schema.Types.ObjectId], } }); I would ...
Adrian John's user avatar
0 votes
1 answer
51 views

Group Array Object nested object by key and Iterate Through Them

I have an array object with nested objects inside. In each object of the array object is a nested object, i want to do the following: Iterate through the testInfo property of the participantDetails ...
Raul Hernandez's user avatar
0 votes
2 answers
59 views

How to compare two arrays at the index and also include null values in the new array output

So I am very new to coding and have run into an issue when it comes to comparing arrays, especially ones that are nested and trying to pull out values that match using their indices into a new array. ...
too twiisted's user avatar
0 votes
2 answers
52 views

Array change listener callback not getting arguments

So I've been scratching this mental itch and was checking out how to handle change listeners to arrays without using Observables or external libraries. The main idea is that I have a .json file which ...
Zed_Blade's user avatar
  • 1,081
-1 votes
1 answer
29 views

Need to fix for loop in etherjs

hi im a newbie and i have a problem with for loops. my code is here async function claims(epoch) { let epochs = []; for (let i = 0; i < 10; i++) { rounds = epoch - i; const claimable = ...
rainboy's user avatar
0 votes
2 answers
88 views

Array not resetting in JavaScript while reading from stream

I am trying to insert data coming from a remote CSV file in MongoDB (using Mongoose). I would like to do so in bulk inserts of 100 items at a time. Here's my code: import csv from 'csv-parser' import ...
mrodo's user avatar
  • 581
0 votes
0 answers
58 views

How to Batch and Timeout Tasks with RabbitMQ in Node.js?

I'm working on a project that interacts with the blockchain using Node.js and RabbitMQ. I need to implement a system where tasks are batched into an array before being sent to the blockchain. The ...
Matin's user avatar
  • 76
0 votes
0 answers
43 views

I can not pass an array to Airtable create method in Nodejs

I am trying to use Airtable for the first time. I want to simply create a record into a table in Airtable. The record is an array of objects. When I had the data as an object, it went through. But it ...
valve's user avatar
  • 45
0 votes
0 answers
38 views

How to see if object is in a list [duplicate]

How do I in Node.JS check if a object like {idx: X, idy: y} in is in a list? I've tried with .index and other things, but I think because it is a object with multiple values it fail. My list has the ...
Henrik's user avatar
  • 13
-2 votes
1 answer
38 views

Does the concept of Index is available for LinkedList in DSA?

Does LinkedList have index to get accessed, as how we have it for array?? If yes, please let me know how the index work in LinkedList concept?? Thanks I am beginner with LinkedList and wanted to ...
sanup divakaran's user avatar
1 vote
0 answers
97 views

Variables from buffer in nodejs

I am studying pure nodejs, no express, no fastify and other frameworks that's why I don't need npm mutler and file-upload. I am sending 2-3 mp3 files and two txt files from a client side to a nodejs ...
Constantin Konstantin's user avatar
1 vote
0 answers
41 views

How to replace/fill div values in the Table.Cell React

I have a React table and I want to load all general data on the loading. And data that is not already loaded, I want it to be stored like empty lines. For example, I have a Table.Cell in the Table.Row ...
Programmer's user avatar
0 votes
1 answer
26 views

React dynamically fill the select component and pic one selected value on form submit

using hook forms, I want to submit form data with a select option for department and these department filled dynamically from the server I have a select component with is picking my selected values ...
Marklod Prosper's user avatar
-3 votes
1 answer
116 views

Converting 2-column text file to key/value pairs [closed]

I am currently learning Node.js and Express. I'm trying to convert a text file into key-value pairs. My staircase program works like this: The provided text file looks like this (with 300 lines): I ...
Lisa S's user avatar
  • 11
0 votes
1 answer
39 views

NodeJS Changing all Instances of an Array inside a Nest Object

I have nested array of objects with an array inside of each object. const nestedArray = [ objectTemp{foo: "", lines: []} ] <---- simplified example of the nested array structure. I am ...
NoahDuV's user avatar
1 vote
2 answers
101 views

Problem when performing a push to a nested array in mongodb and nodejs

I am having a problem when performing a push to a nested array, I am trying to add one or more objects within the nested array "fieldList", when I execute the push it tells me ok but when I ...
Gianni Narracci's user avatar
0 votes
0 answers
54 views

How to convert array of arrays to formatted Excel file in React.js/Node.js?

I have an array of arrays representing a table. It looks something like this - [ ["Name", "Age", "Description"], ["John Doe", "26", "<div ...
Andy's user avatar
  • 11
0 votes
1 answer
125 views

Convert object to buffer and buffer to object

Demo const result = [ { // This is sample data BUT there can be multiple objects "name": "object1", "id": "1", ...
micronyks's user avatar
  • 55.4k
-1 votes
1 answer
75 views

Issues with my Javascript code to parse files

I am currently working on implementing a JavaScript code that aims to read and parse some numpy .npy files generated from Python's numpy, specified by a JSON file. These .npy files contain arrays of ...
Mary H's user avatar
  • 409
1 vote
2 answers
132 views

how to pass json array in params to get rest api in nodejs

I have one GET API which is having array in the input. I want to call that API through in my node.js project. I have tried many options but none worked. This is my REST Request. let request = await ...
akilesh's user avatar
  • 25
0 votes
0 answers
76 views

X-Forwarded-For in the request-ip package potential bug

I was reading the request-ip code. (Link here) and I noticed that when dealing with the X-Forwarded-For part it is treated as if it will only be a string always. when in reality it's very possible ...
user avatar
0 votes
1 answer
103 views

how to convert a string to array of object in nodeJS

Hi all I have one string which I need to convert in array of object in node JS. as : var result = "[{'path': '/home/media/fileyear.jpg', 'vectors': [0.1234, 0.457, 0.234]}, {'path': '/home/media/...
Rajesh Kumar's user avatar
0 votes
1 answer
68 views

I am getting 'files are empty' with a 400 code

I am trying to upload images to strapi, what am I doing wrong here? am I putting the fileArrayForUpload in the wrong place? the fileArrayForUpload is not empty. handleCreateSubmit: const [...
Miguel Ângelo Freitas's user avatar
-3 votes
1 answer
57 views

How do I add an object at a specific location in an array with multiple nested objects

This is my Object: [ { "id": "1709408412689", "name": "WB1", "children": [ { "id": &...
RKRdev's user avatar
  • 17
0 votes
1 answer
35 views

Line breaks in the vscode terminal output, disturbing the view. when used more than 6 elements in an array [duplicate]

Line breaks in the Vscode terminal output, disturbing the view. when more than 6 elements are in an array. const a1 = [2,14,4,3,6,9] console.log(a1) Results (Console): [ 2, 14, 4, 3, 6, 9 ] BUT If ...
WILLIAN ALMEIDA DE FARIAS's user avatar
0 votes
2 answers
38 views

How can I check filenames to avoid pushing them into array?

I have this code in my node script const fs = require('fs-extra'); const backupPath = path.join( __dirname , 'wp-backup'); const excludedResources = ['.DS_Store', 'dep.js', 'node_modules']; const ...
newbiedev's user avatar
  • 3,596
0 votes
1 answer
397 views

Joi schema: dynamic allow/items validation - "Method no longer accepts array arguments"

I have the need to "extend"/use the schema.items()/schema.allow() with a array, where items can be added. const Joi = require("joi"); const allow = ["foo", "bar&...
Marc's user avatar
  • 3,924
1 vote
3 answers
83 views

Why is node not allowing a For loop?

I was trying to use a for loop to loop through an array of string and then use the string id_Arr[i] as a link partial to call an API. In regular JS/Angular all works well but in node the requests gets ...
almostasnecessary's user avatar
1 vote
1 answer
217 views

how to add items into array in node js with mongodb?

i'm writing a bot that is able to randomly pick out a card from a .json file i have, and should add it into the user's card inventory. each card comes with it's own unique code. if the user had the ...
eggosbae's user avatar
1 vote
4 answers
88 views

Combining relevant data in two different arrays

Can you help on how to combine data in two different arrays with different structures? I take data via API, the first request: [ { "category_id": "12345", "...
hikx's user avatar
  • 23
2 votes
1 answer
77 views

add data to an array within other arrays with a recursive function

I'm trying to add data to an element which inside it has an array, and that array others, and so on consecutively. I made a function to be able to traverse the entire element until finding the one I'm ...
SrPino23's user avatar
0 votes
3 answers
97 views

Map function not returning all the arrays

So here I am trying to map through multiple arrays, and return all the data related to it. But only the first array is getting returned. The strange thing here is that when I try console logging the ...
Pixel's user avatar
  • 49
0 votes
0 answers
20 views

Retrieving data to an array returns empty [duplicate]

I created a simple application using Node, React and Mongo. When I try to retrieve the data from Mongo, the array to which I'm trying to populate the data returns an empty array. Adding Data works ...
thegaffoor's user avatar
1 vote
1 answer
62 views

Updating object in deeply nested arrays mongoose

{ "_id": "659e76b929be316e566cdc36", "main_array": [ { "_id": "659e76b929be316e566cdc39", "sub_array": [ [ ...
ARHAM RUMI's user avatar
0 votes
0 answers
80 views

Pass array from html to javascript

I'm trying to create a carousel so I can click through each element in csv file: In a routes/index.js file I'm reading a csv file with film data in an array, and then loading this into the index.ejs ...
wizard's user avatar
  • 21
0 votes
1 answer
52 views

How do I read object properties in EJS?

I have an express server that has an API to fetch food items. I have an ejs index file that I want to display the names of food. In server.js I am fetching it like this app.get('/', async (req, res) =&...
Preston Cammarata's user avatar
0 votes
1 answer
343 views

How to do custom order by string using sequelize

How to do custom order by using sequelize I need to sort array of objects retrieved from db as ACTIVE, PENDING, INACTIVE How to do using sequelize Tried sortOrder = [[Sequelize.literal(`CASE WHEN ...
learntocode2468's user avatar
0 votes
0 answers
34 views

I'm using mongoose in my Node JS project and I need to move an object from a certain array to another array

I have a collection in my database with the following data structure demonstrated in the code below. Basically, it is an array of lists and each list has its own array. I am currently using Node JS ...
Rodrigo Serrasqueiro's user avatar
0 votes
1 answer
109 views

How do I display an array that I have created in NodeJS in HTML?

Ok, so I am fairly new to this stuff so I'll try to be as cohesive as I can with my problem. I have created a simple web scraper using NodeJS, Express and Axios. This web scraper scrapes text from a ...
Nate's user avatar
  • 1
-1 votes
1 answer
80 views

Node JS: evaluate value inside array of objects

I have data that looks like this [ [ '@test','1.2.6' ], [ '@test2','4.0.1' ], [ '@test3','2.2.0-unstable' ], ... ] and I would like to retrieve all the values that have appended -unstable and ...
martyzee's user avatar
2 votes
1 answer
130 views

Array update or add as new

I just want to update array value with matching value or add as new Schema imgs : ["imgPath1" , "imgPath2" , "imgPath3" ] I tried with this code but not working let ...
Hunter's user avatar
  • 1,601
0 votes
1 answer
163 views

How do I generate Scratch Card Algorithm on NodeJS?

Greetings to everyone, There is a game frequently played in Turkey. Its name is Scratch. The rules of the game are as follows: If the same three numbers appear in any matrix (3x3, 4x4, 4x3), that ...
resobyte's user avatar
  • 126

1
2 3 4 5
115