Home > Software design >  reactJS MongoDB $numberDecimal
reactJS MongoDB $numberDecimal

Time:06-10

I am having issues printing out the "budget":{"$numberDecimal":"600.00"} section of my JSON that I have mapped.

Eveything I have tried won't let me print out the $numberDecimal

Tied wrapping it in a Number, Math and even tried what you can see below.

All I get returned is either NaN or [object Object]

{data.map((camp, index) => {
                return (
                  <tr>
                  <td colSpan={5}>{camp.campaignName}</td>
                  <td>$140 / {camp.budget.toLocaleString()}</td>
                  <td>Active</td>
                  <td><Button>Edit</Button></td>
                </tr>
                  )
            }
            )}

CodePudding user response:

is this what you want ?

{camp.budget['$numberDecimal'].toLocaleString()}
  • Related