Number is inserted to collection as text

Hey Benny, good morning…

So I played with this some more and found out something interesting. Take a look at this code:

export function confirButton_click(event) {
   let orderID = Number($w('#orderNumber').text); // convert to Number
   console.log('typeof', typeof(orderID));
   const toInsert = {
      "user_id": wixUsers.currentUser.id,
      "_ID": orderID,               // use the Number variable here
      "address": $w('#input1').value,

This code seems to work (and my apologies for saving the changes in your site). It seems as if the wixData insert() function gets the types confused when a text field is in the value, even if it is being converted to a Number.

As you can see in my code, I first convert the orderNumber field to a Number, and then use that variable in the toInsert() object.

I’m going to check with QA about this. Not sure if it’s a bug, or just some quirk in the behavior of Javascript (which can be quirky).