Replit database library change

Has the data model structure of the Replit database library [@replit/database] for node.js changed?

It seems like the usual method to retrieve data from the database has changed. Only the value is not provided as before but it comes as an object. If you need the value, you need to call the value property of the object.

This is making it more complicated and also what about the previous programs written? Does this mean that all the previous applications we have developed will malfunction?

Repl link/Link to where the bug appears:

Screenshots, links, or other helpful context:

code snippet

Hi @lc96 !
Try using the official documentation from the npm website here. It seems that you need to import Client from the module.
Hope this helps!

1 Like

They are importing the client. They just gave it a different variable name.

const Client = require('@replit/database');
// vs
const database = require('@replit/database');

is the JS equivalent of

from replit import db as Client
# vs
from replit import db as database

The docs also show that using Client as the name outputs an object anyway:

2 Likes