WixData.query for Invoices

Hi,

Make sure that the title of your collection is “Billing/Invoices” specifically (I would generally avoid backslashes, but I’m not 100% sure this will break anything).

The issue might also have to do with the fact that having “0000059” wrapped in quotation marks makes a string , rather than a number in terms of its JavaScript datatype .

It’s likely the case that the data is stored in your collection as a number, but because you’re attempting to query the database with a string, it’s returning all of the values in the database, which is the default setting when no error handling is set up.

Take a look at the “Create, filter, sort, limit, and run a query” example in the query() documentation , notice how the . gt (“age”, 25 ) line (line 7) is written, and see if that resolves the issue.

It’s also good to get in the habit of using type coercion in any code that will populate your database, so that each entry will be inserted into the collection/database with the correct data type. Some programming languages like TypeScript make you declare the data type from the outset of your variable declaration, but JavaScript sadly doesn’t have that feature.

Hope this helps

Rob