I'm handling data imported to a MongoDb Collection from a Stripe-generated CSV of customers. Some fields from this CSV have spaces in the name, like Card ID, Card Brand and many others.
I'm having a problem accessing these name in the resulting objects of a .find() query:
StripeCustomer.find().then(
(customers) => {
console.log("customer[1]:", customers[1]);
console.log("id:", customers[1]['id']);
console.log("Card ID:", customers[1]['Card ID']);
res.json({
code: 200,
message: 'success',
total: customers.length,
data: customers
})
}
The Card ID property returns undefined.
I tried using encodeURIComponent or other string conversion functions for the property name customers[0][encodeURIComponent('Card ID')] but without result.