use D1 DB in worker (no wrangler etc, just JS)

hey there, noobie here. There are multiple tutorials online how to set up the D1 DB with a worker using wrangler, nodejs etc., however i just want to be able to use all the db related stuff within my js file, so no typescript.
I went ahead and added the database via DB Database bindings in the settings of the worker, however any request i do in js returns empty data:
const { results } = await env.DB.prepare('SELECT * FROM user').all();
const json = await Response.json(results);
const jjson = JSON.stringify(json);
console.log(jjson);

and yes, the DB is called user, the environment variable in the settings is DB.
Am i missing something?
Was this page helpful?