Transfer data from a form database to another database

Question:
I want to make it so that the user can enter an opinion in a form and that a little more base in the pages we recover this information to make a part comment but the problem is that the database of the form we authorizations blocked in admin so I thought that we can transfer its data serves another base.

Product:
I’ve already started, but it didn’t work.

import wixData from 'wix-data';


const baseDeDonneesSource = 'Avis';
const baseDeDonneesDestination = 'test';

const formulaireNom = $w('#wixForms1');


function onSubmit() {
  
  const formData = $w(formulaireNom).value;

 
  ajouterDonneesABaseDeDonnees(formData);
}

function ajouterDonneesABaseDeDonnees(data) {
  wixData.insert(baseDeDonneesDestination, data)
    .then((results) => {
      console.log('Données ajoutées avec succès à la base de données de destination', results);
    })
    .catch((error) => {
      console.error('Erreur lors de l\'ajout des données à la base de données de destination', error);
    });
}

$w.onReady(function () {
  $w(formulaireNom).onSubmit(onSubmit);
});

As long as both databases have the same structure I don’t see why you can’t do this. Are you getting an error message?

Perhaps you need to first strip out certain data like _id and columns related to creation time/modification time/owner as these are automatically created by the database.

I also understand that the Avis database is admin only. Any reason to not change its permissions to be more flexible? “Site member author” permissions for example can make it so only the creator of a row can edit it in the future. CMS: Collection Permissions Overview | Help Center | Wix.com