Select single value from collection

Try this one…

import wixData from "wix-data";

//-----------USER-INTERFACE----------------
const DATABASE = "DATABASE";
const DB_FIELD = "title";
//-----------USER-INTERFACE----------------

$w.onReady(()=>{$w('#button1').onClick(()=>{xxx();});})

function xxx() {
    wixData.query(DATABASE) 
    .eq(DB_FIELD, $w("#input1").value).find()  
    .then((res) => {console.log("Input-Value: ", $w("#input1").value); 
        let items = res.items;       console.log(items);
        let firstItem = items[0];    console.log(firstItem);
        let title = firstItem.title; console.log(title);
        $w("#text1").text = title;
   }).catch((err)=>{console.log(err);});
}

Take a closer look onto - - > CONSOLE! What do you get in CONSOLE?

Replace the values in the USER-INTERFACE-SECTION with your own ones…

  • DATABASE
    -DB-FIELD

Have fun and good luck! (don’t forget to like it, if you really liked it :wink:)