WixData - How to exclude properties from retrieved items?

Hi, I want to retrieve all of the items in my database, but I only need specific properties from each item and not the whole object. How do I do this?

This is my query:
let res = await wixData . query ( “myCollection” ). find ();

And I want to include specific properties from each item retrieved, for example- only ‘name’ and ‘city’ for each item.

How do I do this ?

Do you want to generate a new (OWN) ARRAY or even OBJECT out of your query, including just special DB-FIELDS?

Or do you want just to do some FILTERING?

My collection is pretty big and it has many items and my goal is to increase performance. Therefore, I want query specific fields from my collection, instead of querying the whole collection and filter it’s items later (which I know how to do with JS).

Thank you!

@tisan1 Bad idea! This won’t give you any performance-improvements.

But what you can do is to query in little steps, what do i mean?

Instead of queriying 1000-Queries (which is also by the way the max.), you could do smaler queries, for example 50-Queries (including just 50-items) and if needed you just load next 50 ones and so on…

For example in REPETERS this functionality is very desired! Called → Infinite-Scrolling —> where you seemingly can scroll all your repeated items in an infinite loop inside your repeater showing all items out of your DB (no matter how much items are in your DB).

The 3 main-code-parts for you would be…

  1. .skip(50);
  2. .limit(50);
  3. promisseAll()