0

I want to add the value (number) of "coinId" as a key to the inner object to the MongoDB database. But it takes literally the name of the variable. How do I access its value?

const { result } = await db.collection('users').updateOne(
      { googleId },
      {
        $set: { description: { coinId: { _id, coinId, description, date } } },
      },
      {
        returnOriginal: false,
      }
    );

Sergio Tulentsev
  • 219,187
  • 42
  • 361
  • 354

0 Answers0