Connection to Database doesn't seem to be working

Hi, I have been trying to collect number of clicks on a certain button.
In order to do that I did the following steps:

  1. Create a new DataBase called PrivacySiteDB
  2. I created a button called button1
  3. Under OnClick event I coded the following:

//Add your code for this event here:  
wixData.query("PrivacySiteDB").find().then( (results) => { 
	let item = results.items[0]; 
	item.PrivacyCount++; 
	wixData.update("PrivacySiteDB", item).then(); 
}).catch( (err) =>  
{ 
	wixLocation.to("https://blockstack.org/"); 
}); 

The reason I used the catch/err is to debug and not if it failed somewhere in the code.
It seems that it even doesn’t find the DB and the query returns NULL.

am I missing something?

Thanks,
Adam

Your query will return all of the records in your collection since you don’t have any filter or query parameters. Not sure if that’s what you want.

Also, you need to use the Field Key and not Field Name…

Not this:
item.PrivacyCount++;

But probably this:
item.privacyCount++;