How to assign an ordered id to customers who fill the form

Is it possible to set up a new field so that the first customer who fills in the form to be “1”, the second as “2”, etc.
Since I am still new to the use of hooks, I do not understand why I could not get the results I want with the below code, which is a replicate from a relevant post.

import wixData from 'wix-data';

export function Database_beforeInsert(item, context) { // item contains the inputFields from the form
    return wixData.query("Database")
        .limit(1)
        .descending('field') // descending() sorts the results in descending order by property, i choose "field"
        .find()
        .then((results) => {
            const lastItemInCollection = results.items[0];
            item._id = `${Number(lastItemInCollection._id) + 1}`; 
            
            return item; // beforeInsert function returns the item
});

}

Have a look at this previous forum post as it should be suitable for your needs.
https://www.wix.com/corvid/forum/community-discussion/is-there-a-way-to-make-a-button-add-1-to-a-collection-field-everytime-its-pressed/p-1/dl-5d7586909e46060017124d1e

Or this one if just displaying it on a page etc.
https://www.wix.com/corvid/forum/community-discussion/increment-button-with-1?dvc=c&experiment_id=wix%2Bcode%5Ee%5E209150830980%5E1t1%3B%3Fh&gclid=EAIaIQobChMI7bae8Jzc3AIVGYfVCh0nWgKzEAAYASAAEgJTmPD_BwE&h=https%3A%2F%2Fwww.wix.com%2Fcode%2Fhome&utm_campaign=179424220%5E47357753009&utm_medium=cpc&utm_source=google