load data from database without dataset using wix code

Hi

I want to retrieve all the data in my table into a repeater and set each field to elements in my repeater. my collection name is employees.

How to retrieve data from DB?

The most simple and very very basic code for this will be this one…

$w.onReady(()=>{
   wixData.query("COLLECTION").find()
   .then((res)=>{console.log("Results: ", res);
      let items = res.items; console.log("Items: ", items);
      let firstItem = items[0]; console.log("First-Item: ", firstItem);
      let firstItemTitle = items[0].title; 
      console.log("First-Item-Title: ", firstItemTitle);
   });
});

Of course this code is not perfect and should be expanded with some more logic.

Thank you

1 Like

Let me know, if you could find your solution.

@russian-dima with res, how do we set these results in to a repeater? do we have to use a loop?