filtering a DataSet in Wix Code

@erx214 Thank you for this update, I’m a musician with a bit of coding background but totally newbie with Wix Code, having a Collection of concerts, my goal is to split views, history and next shows. I already managed to set the filter but as @Jamie points I get first the whole list (200) and then the filter by date now() hide correctly the greater or low shows by date. I’ve tried to implement your solution but I get an error that I can only interact with a dataset already declared in the editor.

https://www.vibrandmusic.com/concerts

Here is my code:

import wixData from 'wix-data';
let n = new Date();
function myquery() {
    let query = wixData.query("datasetConcert")
    query = query.limit(3);
    //put here all your query criteria
    query.find()
        .gt("fecha", n)
        .then( (results) => {
        $w("#repeater1").data = results.items;
        });
    }
$w.onReady(function () {
 // I commented that to test your solution
 //   $w("#datasetConcert").setFilter(wixData.filter()
 //    .gt("fecha", n) 
 //   )
 $w("#datasetConcert").onReady( () => {
    myquery();
  } );
});

I get the error even if I didn’t delete the #datasetConcert from the editor.

I would greatly appreciate a full working example, many thanks in advance.