WixData.query for Invoices

Im trying to query for a specific invoice by its number using the code below:

wixData . query ( “Billing/Invoices” )
. eq ( “number” , “0000059” )
. find ()
. then ( ( results ) => {
console . log ( results );

However, the results always return all the invoices without filtering for the specific invoice. I had try filtering with other fields with same results too. This method of query and filter seems to work for other collections, why is it not working for Billing/Invoices?


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


I have the same issue and I am afraid, that Wix is not allowing that (Billing/Invoice) query to be specified… Other internal Databases work perfectly fine… Am I right?

Despite the fact, that this question is old and not that popular: a way of solution for everyone with the same problem:

It seems that the Billing/Invoice is indeed not allowed to be filtered AND it is limited to 50 items (.limit() does not work either). After trying this for serveral days I came up with a little workaround:

Create a “buffer” database, that is fed with the Billing/Invoice data regularly… You can copy/paste the existing InnvoiceDatabase Items once into your new database and code a little snippet, that is hidden on a crowded site of your webpage. So every time a visitor enters this site, your bufferDatabase will get the new Invoices Data. Just make sure, that you update the data BEFORE 50 new Invoices-Items are sent to Billing/Invoices Database