Last active
May 12, 2020 14:02
-
-
Save b-bot/43858d50a3dbaa110355aaff89ce3ed2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The `CreateCollection` is similar to `CREATE TABLE ` in SQL. The same for `CreateIndex`. | |
CreateCollection({name: "artists"}); | |
CreateCollection({name : "songs"}); | |
CreateCollection({name : "albums"}); | |
// We are emulating the primary keys of each respective table by specifying unique as true. | |
CreateIndex({name : "artists_by_id", source : Collection("artists"), terms : [ {field : [ "data", "artist_id" ]} ], unique : true}) | |
CreateIndex({name : "songs_by_id", source : Collection("songs"), terms : [ {field : [ "data", "song_id" ]} ], unique : true}) | |
CreateIndex({name : "albums_by_id", source : Collection("albums"), terms : [ {field : [ "data", "album_id" ]} ], unique : true}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment