Storing an Array of String to a Key in MongoDB

Solution 1:

You could modify first your payload into the format of schema.

Payload

const educationData = [
  {
    degree: 'Masters',
    A: 120,
  },
  {
    degree: 'Bachelor',
    A: 98,
  },
  {
    degree: 'PhD',
    A: 86,
  },
  {
    degree: 'Industry',
    A: 99,
  },
  {
    degree: 'Associate',
    A: 85,
  }
];

Process

const newEducations = educationData.map(education => {
    return `${education.degree}:${education.A}`;
});

const storeRole = new RolesPositionSchema({
    title: 'Data Analyst',
    desc: 'Using both internal and external data sources you will develop insights to identify trends and opportunities whilst highlighting areas or improvement to optimise member interaction. This is a proactive role where you will own how we interpret data, allowing you to   provide valuable insight into the development and implementation of product, customer and channel strategies for our sales, retention, and acquisition goals.',
    skills: [{Skill value}],
    salary: [{Salary value}],
    education: newEducations,
    popularity: 0,
    reccomendations: [{Recommendation value}]
});

After this saved. Does it that you want?