Collection had "regno" column, on first insert another column got create as "[regno]"

  1. I created a collection with two column as
    regno
    Numbers

  2. On first insert in the collection, two new columns got created
    [regno]
    [Numbers]

code used:
let newCustomer = {
“regno”: “30”,
“Numbers”: “103”
};
wixData.insert(“studends”, newCustomer);

  1. Below is how my collection looks like.


4. when I try to query using regno and not [regno] , I am getting null

const results = await wixData.query(“studends”)
.eq(“regno”, “1”)
.find();
console.log(results.items[0]);
return results.items[0];

console.log(results.items[0]); is giving null. Even though there is a record in regno as shown in the above image.

Please help me with this.

Are your dataset fields set as numbers or text?

It only matches values of the same type. For example, a number value stored as a String type does not match the same number stored as a Number type.
https://www.wix.com/corvid/reference/wix-data.WixDataQuery.html#eq

Adding more information for Point number 3.
Field Name: regno Field Type: Text Field Key: title
Field Name: [regno] Field Type: Text Field Key: regno

This is how fields are defined in my collection.

here I would also like to understand what is the difference between Field Name and Field Key?

For info about what field names, field keys and field types mean, then read these page here.
https://support.wix.com/en/article/about-your-database-collections-fields -wix support dataset collection
https://support.wix.com/en/article/about-your-database-collection-fields#field-type -wix support advanced

You can easily change your field type too, however this will affect your dataset.
https://support.wix.com/en/article/changing-a-database-collection-field-type

For field type limitations, then see here.
https://support.wix.com/en/article/field-type-support-and-limitations-in-the-data-manager

Finally, as already posted in my first reply, have a read of the wix data filter function that you are using.
https://www.wix.com/corvid/reference/wix-data.WixDataQuery.html#eq

So, as you have stated that your field type is set to ‘Text’, then your query will be looking for the number as a text string like ‘One’, whereas you have put the query as ‘1’ which would work if your field type was ‘Number’. (Number -2147483647 to 2147483647).

eq( )
Refines a query or filter to match items whose specified property value equals the specified value.

Description
The eq() function refines a WixDataQuery or WixDataFilter to only match items where the value of the specified property equals the specified value.

It only matches values of the same type. For example, a number value stored as a String type does not match the same number stored as a Number type.

Matching strings with eq() is case sensitive, so "text" is not equal to "Text".

If the value of the propertyName property is an Array, eq() includes items in which any of the elements of the Array match the specified value.

I would suggest that you have two separate new fields for regno and [regno] instead of using the title field which is automatically created when you use a dataset, so that this way you can have both the field name and the field keys set as regno and [regno], so it doesn’t get confusing etc.

As currently, you have a field name of ‘regno’ with a field key of ‘title’. then you also have the other field name of ‘[regno]’ with the field key of ‘regno’