Skip to content

NogutiCode/RethinkDB-Guide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

RethinkDB GUIDE

What is RethinkDB?

  • Open-source database for building realtime web applications
  • NoSQL database that stores schemaless JSON documents
  • Distributed database that is easy to scale
  • High availability database with automatic failover and robust fault tolerance

RethinkDB is the first open-source scalable database built for realtime applications. It exposes a new database access model, in which the developer can tell the database to continuously push updated query results to applications without polling for changes. RethinkDB allows developers to build scalable realtime apps in a fraction of the time with less effort.

Installation Guide

First of all you must download the docker

You need to visit website : https://www.docker.com/
And download the docker.

After installation docker, you need to open it.
If you want do same steps like me just follow my steps.

If you dont have git and any terminal. I would recommend to donwload.
Git: https://git-scm.com/download/win
Terminal: https://github.com/Eugeny/tabby/releases/tag/v1.0.184

After you downloaded docker, git and terminal.
You can start using the RethinkDB.

How to run RethinkDB?

Open terminal and make directory, and follow the directory

Install RethinkDB:

docker pull rethinkdb

make directory:

mkdir nosql

follow the directory:

cd nosql

After those steps you must make file with name: docker-compose.yaml
Into that file you need to write those strokes:

version: '3.9'

services:
  rethinkdb:
    image: rethinkdb:2.4
    ports:
      - 8080:8080
    volumes:
      - ~/apps/rethinkdb/data:/app

Dont forget save the file

Now you can switch to terminal

and write that stroke into terminal:

docker compose up

Congratulations now your database works

If you want shutdown DB

  • Do Ctrl+C

To use DB you need go to your browser

In search line you need to write that stroke

http://localhost:8080/

after those steps u can add some tables and databases.

Workspace will look like that:

Common commands for using the database

To start editing you need to click on "Data Explorer"

 

Commands to work with Database

Create Database

r.dbCreate('Ta20v');

Drop Database

r.dbDrop('Ta20v');

List all Databases

r.dbList();

 

Commands to work with Tables

Create Table

r.db('Ta20v').tableCreate('Class');

Drop Table

r.db('Ta20v').tableDrop('Class');

List all tables in selected daatabase

r.db('Ta20v').tableList();

Create index in table / Also you can drop index etc.

r.db('Ta20v').table('Class').indexCreate('Name');

 

Commands to Writing Data

Insert data into table

r.db('Ta20v').table("Class").insert({
    id: 1, // if you want set ur id / or u can remove those stroke to set primary key
    Name: "Aleksander",
    Age: "18"
})

Update data in table

r.db('Ta20v').table("Class").get(1).update({Name: "Sasha"});

Replace data in table

r.db('Ta20v').table("Class").get(1).replace({
    id: 1,
    Name: "Kolja",
    Age: "17",
});

Delete data in table

r.db('Ta20v').table("Class").get("1").delete(); // get(1) its id of element

What kind of data can be inserted?

State of ReQL data types

Official RethinkDB docs: https://rethinkdb.com/docs/data-types/

What is the advantage of this database?

Rethink is a document-oriented database and it is a free and open-source distributed database. Basically, it is a JSON document with dynamic schemas, normally JSON is used to store the dynamic data that provides the real-time facility to update the database by using the query.

I’ll add on my own that it has a very user-friendly interface and you won’t get lost in it.They have very clear documentation on their website. And writing code is a pleasure because it is simple and somewhat similar to mysql.

Conclusion

I really liked this database, and probably I will use it in the future to store information. :)
If you missed something and didn’t add it, you can always go to their official website and read the documentation.

About

How to set rethinkdb + work with it

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published