Custom password validation against database

Hello! I have been trying to make a client portal where a user can input a ID code and have it verified against a database. My code looks like this.

import wixData from 'wix-data';

export function Submit_click(event) {
	console.log('Click!');
	const userInputText = $w('#orderIDInput').value;
	wixData.query('Orders').find().then(result => {
		const orderInfo = result.items[0];
		if (orderInfo.orderKey === userInputText) {
			
			$w('#orderIDInput').hide(); //hide input
			$w('#Submit').hide();
			$w('#verified').show(); //show text verified
			console.log('All set!');
			
		} else {
			console.log('error');
		}
	});
}

However, when run, no result is returned. I have been looking at this for hours and can’t figure out why! Any help would be appreciated.

Best,
jerry909

The problem most likely is that you are using the Field Name and not the Field Key.

Not this:
wixData.query(‘Orders’).find().then(result => {

But this:
wixData.query(‘orders’).find().then(result => {

That is, not Orders , but orders.

Read about Field Keys for more information.

Good luck,

Yisrael