Book Image

Mastering RethinkDB

By : Shahid Shaikh
Book Image

Mastering RethinkDB

By: Shahid Shaikh

Overview of this book

RethinkDB has a lot of cool things to be excited about: ReQL (its readable,highly-functional syntax), cluster management, primitives for 21st century applications, and change-feeds. This book starts with a brief overview of the RethinkDB architecture and data modeling, and coverage of the advanced ReQL queries to work with JSON documents. Then, you will quickly jump to implementing these concepts in real-world scenarios, by building real-time applications on polling, data synchronization, share market, and the geospatial domain using RethinkDB and Node.js. You will also see how to tweak RethinkDB's capabilities to ensure faster data processing by exploring the sharding and replication techniques in depth. Then, we will take you through the more advanced administration tasks as well as show you the various deployment techniques using PaaS, Docker, and Compose. By the time you have finished reading this book, you would have taken your knowledge of RethinkDB to the next level, and will be able to use the concepts in RethinkDB to develop efficient, real-time applications with ease.
Table of Contents (16 chapters)
Mastering RethinkDB
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

Horizon user management


If you are using Horizon's Authentication system and not any third party authentication, such as Facebook, Twitter, and so on, user information is stored in a special Horizon collection called users.

You can use the user's collection either by loading it similarly to other collections, or access it directly as shown in the following code:

const horizon = Horizon();
// Access as a standard collection
const users = horizon('users'); 
// Access through the shortcut
const users = horizon.users; 

Note

Note: Third-party authentication is not in the scope of this chapter, however you can learn about it here http://horizon.io/docs/auth/.

When a new user is created, Horizon assigns it two user groups, which are:

  • Default: Rules for all the users

  • Authenticated: Rules for those users who are authenticated by the system

These user groups are used to assign permission to the user. A typical document in the users collections looks like this:

{
     "id":...