Getting unwanted result from replit db.
So I created a database in Node and set the key to a username. But when I try to print it out, I get this:
const Database = require("@replit/database") const db = new Database() var username = process.env.REPL_OWNER var stats = [10000/*Money*/, 0/*Bank*/, 1000/*Deposited*/, ""/*Occupation*/, []/*Inventory*/] db.set(username, stats).then(() => {}) console.log("Moeny: "+ db.get(username).then(value => {}))
I get:
Moeny: [object Promise]
Why am I getting this and how can I return the value assigned to the key?
Voters
because it’s a promise you must do this:
Yeah, but when I change the code to this:
I get
Any idea why?
@ruiwenge2
@OldWizard209 thats because the value is a dictionary.
try this: