Troubles with Collection Entries

Hello,

I am trying to modify a collection using the code below to add an element. The variables “name” and “file” are appropriately defined in code before the let statement. The problem is that the collection creates new fields named like “[Title]” and “[Image]” and does not recognize the existing fields in the collection, that have the same name. II have tried all the options like naming the fields in the “toInsert” variable as “Title” or ‘Title’ and such, but nothing helps. You should know that the fields Title and Image are not the only one in the collection, but I have commented out the others for brevity. It must be something very simple I am missing because I could not find any other user with the same problem on the forum. Thanks for the help.

let toInsert = {
Title: name, // not matter how I define the field here (like “Title” or ‘title’),
// the collection “abstract” below will always create a new field named [Title]
Image: file.url,
};

wixData.insert("abstract", toInsert) 
	.then((results) => { 
		let item = results; //see item below 
		console.log("done writing in database"); 
	}) 
	.catch((err) => { 
		let errorMsg = err; 
	});

Hi,
Sounds weird,
Can you please share a link to your site and specify the name of the page so we can inspect?
Roi.

hi

the page is on the site www.annabrunelli.com, look under admin/Upload Paintings_old. It is a hidden page, so you will have to be a super user I guess to access it. I have made the same version with regular dynamic link under admin/Upload Paintings, which works - but I wanted to get acquainted with your API so I decided to write the brute force code myself.

Thanks