Ask coding questions

← Back to all posts
Urgent please tell :Repl.it db
ROCKINGRAYQUAZA

HI THERE!

How to add multiple values to a single key in repl.it database in python

How to view your repl.it database

In python!

Regard,
Rayquaza

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
ROCKINGRAYQUAZA
Comments
hotnewtop
Coder100

3 questions?!?
Ok...

ROCKINGRAYQUAZA

these were added by you but if I want that when my bot is added to a new server the owner provide some channel id how will i store that?
@Coder100

Coder100
Coder100

ok, something like:

@ROCKINGRAYQUAZA

ROCKINGRAYQUAZA

Like you can think of it as a input function into a dict @Coder100

ROCKINGRAYQUAZA

In discord.py !! @Coder100

ROCKINGRAYQUAZA

btw thanks I understood @Coder100

Coder100
Coder100

just treat the database as a magical dict that saves
anything you can do to a dict, you can to our database :D
@ROCKINGRAYQUAZA

ROCKINGRAYQUAZA

Also if we want to make nested keys, like:

Coder100

reee didn't I say you can treat it like a dict? @ROCKINGRAYQUAZA

Coder100

@ROCKINGRAYQUAZA

ROCKINGRAYQUAZA

ok thanks @Coder100

Coder100
LTI2
Coder100

umm ok @LTI2

ROCKINGRAYQUAZA

hi man @LTI2

LTI2

@Coder100 i know it's random

lekdnlwkfkwflwnf0393iefwf

@Coder100 how do i get the value of a subkey tho

Coder100

there are no subkeys
the db gives you either an array, dict, string, or that sort depending on what you set it to. So then treat that value as that. @myxi

KraziDev12345

im using nodejs and trying to store username/password in repldb using db.set('username', req.body.username) and same for password but when trying it only stores username and when I go with just 1 instead of req.body.username and 2 instead of password it still only stores 1. idk man pls [email protected]

AntonioJesus3
Spacecraft

I don't think this is possible. You can assign one value to one key. But, there's nothing that prevents you from entering multiple entries into one key value, like this:

You would need to split the value string up by commas after reading it, but it could work for you depending on your specific application.

Coder100

actually no, repl.it db automatically turns that into JSON which can then be parsed back into it's original form @Spacecraft

Spacecraft

I use this to view a list of all keys in the database:

Spacecraft

Oh, cool, didn't know that. Thanks for the info. @Coder100

Bookie0
ROCKINGRAYQUAZA

So we meet again bookie0 :) @Bookie0

ROCKINGRAYQUAZA

can you help me with my discord bot? i.e. new functions and stuffs [email protected]

Bookie0

ah yes lol @ROCKINGRAYQUAZA

Bookie0

i dont know how to make a discord bot, but yea I do know functions and stuff @ROCKINGRAYQUAZA

ROCKINGRAYQUAZA

you can tell if you get any idea for my bot also if you like then join my server I have given you the link!! thanks for your help @Bookie0

Bookie0

@ROCKINGRAYQUAZA ok later i will give some suggestions