Is There Anyway To Get the Item Number of an Collection Item?

In all the query results I’ve ever seen, there’s no item number listed in the collection?

Your query will return the “_id” field. Is that what you are looking for?

No, I “was” looking for an item’s collection index number (the “0”, “1”, “2”, etc), left of the “Title” field in the collection (the value referred to as part of “.items” when working with queries. I didn’t have the vocabulary to explain myself in the OP.

I thought it was this number I was referencing when using “.items”. I now see that it “changes” depending on the results of the query.

What I mean by changes is that if my query returns five items (of 25 in the collection, for example), the “count” is 0 to 4 (regardless of what the items’ collection collection index number are).

Thank you very much, though. I’ve got a much better understanding of collections after yesterday, today, and your input.

If I’m wrong or misunderstanding anything above, please let me know.

1 Like

Yes, you won’t want to rely on the row numbers of the collection as they aren’t always going to be the same depending on your query and what’s returned as you’ve mentioned.

If you require an order to your data, one idea is to have a field that contains this value so that no matter where the row falls in the query result you can use that field to maintain the order

There are likely other approaches too.