Back

[CLOSED] Is there a way to access the database by name?

  • 0
  • Web
leonardorick
21 Oct, 2023, 20:26

Something like:

TypeScript
databases
      .getDocument('maindb', 'users', '932704e53a242ff3c02l')
TL;DR
There was a question about accessing the database by name. The answer is yes, you can use a custom ID for the database ID to simplify things when using multiple environments. Here is an example of how to do it: ```javascript databases.getDocument('maindb', 'users', '932704e53a242ff3c02l') ```
Drake
21 Oct, 2023, 20:27

No...you could have used a custom id for the database id

Eldad
21 Oct, 2023, 20:31

@leonardorick as Steven mentioned, you can use the custom ID which was designed exactly for this use case

Eldad
21 Oct, 2023, 20:32
leonardorick
21 Oct, 2023, 20:33

Yeah, but since I'm using multiple environments I wonder if that was possible (or something like that) to simplify things. But ok, thanks!

leonardorick
21 Oct, 2023, 20:33

[ANSWERED] Is there a way to access the database by name?

Drake
21 Oct, 2023, 21:14

[CLOSED] Is there a way to access the database by name?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more