question

AmadiSajini-8144 avatar image
0 Votes"
AmadiSajini-8144 asked AlexZhu-MSFT answered

when exporting csv the columns get doubled .nodejs mongo

i try to export csv with users and their subcats.date,email,category type and subcats are the columns. but when i export the csv subcats get duplicated.not other date email category and type. only subcats get repeated. there are various subcats for a user. subcats are given to the user randomly but exactly there should be 15 subcats for a user among all subcats. following is my code.

 var count = 0 var csv = []
    
 users.forEach(userele => {
    
 count++
    
 let userObj = userele.users.map((val, index) => {
     let object = {}
     object[`${val.subCats}`] = getuser(val.user)
     return object
 })
    
 for (key in userObj) {
     userObj[" " + (parseInt(key) + 5)] = userObj[key]
     delete userObj[key]
 }
    
 var expAr = {
     "Date": Date,
     "Email": userele.email,
     "Category": userele.category,
     "type": userele.type,
     ...userObj,
 }
 csv.push(expAr)
 })

when i trying to export csv, the columns get repeated.i would appreciate if any one can give me a support to solve this.

msc-operations-manager
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

AlexZhu-MSFT avatar image
0 Votes"
AlexZhu-MSFT answered

Hi,

Sorry for disappointing you, it seems the problem has nothing to do with Microsoft System Center Operations Manager (a monitoring tool, such as Nagios or Zabbix, not related to developing). Since Node.js and MongoDB are not Microsoft products, we may visit their corresponding forums to see it we can get help.

https://nodejs.org/en/get-involved/

https://www.mongodb.com/community/forums/

Note: the above links are not from MS, just for your reference.

Alex
If the response is helpful, please click "Accept Answer" and upvote it.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.