&b      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~              ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                                                                                            ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                    SafeSafe  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~SafeSafeSafe  Safe   SafeNone135G A ReQL value           !"+     +     p            !" SafeA table description+when Nothing, use the connection's database!A database, referenced by name !"#$#$%&'  !"#$ !"# $  !"#$#$%&' None!"135;=GN%)Convert other types into ReQL expressions& A ReQL Term).An upper or lower bound for between and during*An inclusive bound,An exclusive boundA*A key/value pair used for building objectsEBuild arrays of exprs(A list of termsH,An operation that accepts optional argumentsI+Extend an operation with optional argumentsJState used to build a Term)(A term ready to be sent over the networkP&Internal representation of a ReQL Term` Build a termaBuild a term with no optargscnA shortcut for inserting strings into ReQL expressions Useful when OverloadedStrings makes the type ambiguousd6A shortcut for inserting numbers into ReQL expressionskAn empty objectlAdd a note a a ReQL TermaThis note does not get sent to the server. It is used to annotate backtraces and help debugging.%&)*+,-./0123456789:;<=>?@ABCDEF(*GHIJKLMNO)+,PQRSTUVWXYZ[\]-.^_/0`a1234567bcd89:;efghij<kl=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~F%&)*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklH&Z[a`PQUWRSTVXY<=e6g345%:;JKLMNO]cdABCD?>@HI^G\f)*,-./+++jbk789012l_EFhi|%:;&Z[)*,-./+++0123456789<=>?@ABCDEF(*GHIJKLMNO)+,P QUWRSTVXY\]-.^_/0`a1234567bcd89:;efghij<kl=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~B None+G sThe response to a query#A connection to the database serverThe next token to useThe default database.Create a new connection to the database serverExample:4 connect using the default port with no passphrase (note: IPv4 and IPv6 supported)&h <- connect "localhost" 28015 Nothing $>>> h <- connect "::1" 28015 NothingSet the default databaseYThe new handle is an alias for the old one. Calling close on either one will close both.Close an open connection Get the next value from a cursor Get the next batch from a cursor/A lazy stream of all the elements in the cursorA strict version of collect2Wait for NoReply queries to complete on the servern() <- runOpts h [NoReply] $ table "users" # get "bob" # update (\row -> merge row ["occupation" := "teacher"]) noReplyWait h Get information about the serverNmnopqrstuvwxyz{|}~,mnopqrstuvwxyz{|}~,stuvmnopqwxyz{|}~r/mnopqrstuvwxyz{|}~None!"1351Convert the raw query response into useful valuesPer-query settings+Deprecated. Use `ReadMode Outdated` instead"Run a query with the given options%Run a given query and return a Resultrun h $ num 1 :: IO Int1 7>>> run h $ str "foo" :: IO (Either RethinkDBError Int)P** Exception: RethinkDB: Unexpected response: "expected Int, encountered String"#run h $ str "foo" :: IO (Maybe Int)Nothing >>> run h $ str "foo" :: IO IntP** Exception: RethinkDB: Unexpected response: "expected Int, encountered String"Qc <- run h $ table "users" # orderBy [asc "name"] # (!"name"):: IO (Cursor Datum)next c Just "bill" collect c["nancy","sabrina"]$Run a given query and return a DatumT; None,The time and date when the query is executed >>> run' h $ nowWBuild a time object from the year, month, day, hour, minute, second and timezone fields%run' h $ time 2011 12 24 23 59 59 "Z"Time<2011-12-24 23:59:59 +0000>DBuild a time object given the number of seconds since the unix epochrun' h $ epochTime 1147162826Time<2006-05-09 08:20:26 +0000>+Build a time object given an iso8601 string+run' h $ iso8601 "2012-01-07T08:34:00-0700"Time<2012-01-07 08:34:00 -0700>%The same time in a different timezone$_ <- run' h $ inTimezone "+0800" now)Test if a time is between two other timesLrun' h $ during (Open $ now R.- (60*60)) (Closed now) $ epochTime 1382919271falseExtract part of a time valueExtract part of a time valueExtract part of a time valueExtract part of a time valueExtract part of a time valueExtract part of a time valueExtract part of a time valueExtract part of a time valueExtract part of a time valueExtract part of a time valueExtract part of a time value(Convert a time to another representation(Convert a time to another representationNone$Convert a line object into a polygon6run' h $ fill $ line [[-122,37], [-120,39], [-121,38]]2Polygon<[[-122,37],[-120,39],[-121,38],[-122,37]]>9Convert a GeoJSON object into a RethinkDB geometry object?run' h $ geoJSON ["type" := "Point", "coordinates" := [-45,80]] Point<-45,80>9Convert a RethinkDB geometry object into a GeoJSON object2run' h $ toGeoJSON $ point (-122.423246) 37.7793886{"coordinates":[-122.423246,37.779388],"type":"Point"}2Search a geospatial index for intersecting objectsIrun' h $ table "places" # getIntersecting (point (-122) 37) (Index "geo")[]0Query a geospatial index for the nearest matchesIrun' h $ table "places" # getNearest (point (-122) 37) (Index "location")[]wrun' h $ table "places" # ex getNearest [maxResults 5, maxDist 10, unit Kilometer] (point (-122) 37) (Index "location")[]/Test whether a geometry object includes anotherCrun' h $ circle (point (-122) 37) 5000 # includes (point (-120) 48)false'Test if two geometry objects intersectsMrun' h $ intersects (line [[-122,37],[-120,48]]) (line [[-120,49],[-122,48]])falseCreate a line object"run' h $ line [[-73,45],[-122,37]]Line<[-73,45],[-122,37]>Create a point objectsrun' h $ point (-73) 40 Point<-73,40>Create a polygon object.run' h $ polygon [[-73,45],[-122,37],[-73,40]]/Polygon<[[-73,45],[-122,37],[-73,40],[-73,45]]>Punch a hole in a polygonprun' h $ (polygon [[-73,45],[-122,37],[-73,40]]) # polygonSub (polygon [[-73.2,40.1],[-73.2,40.2],[-73.3,40.1]])ePolygon<[[-73,45],[-122,37],[-73,40],[-73,45]],[[-73.2,40.1],[-73.2,40.2],[-73.3,40.1],[-73.2,40.1]]>'Create a polygon approximating a circleGrun' h $ ex circle [numVertices 6, unit Kilometer] (point (-73) 40) 100Polygon<[[-73,39.099310036015424],[-74.00751390838496,39.54527799206398],[-74.02083610406069,40.445812561599965],[-73,40.900549591978255],[-71.97916389593931,40.445812561599965],[-71.99248609161504,39.54527799206398],[-73,39.099310036015424]]>4Distance between a point and another geometry object 4run' h $ distance (point (-73) 40) (point (-122) 37) P467303546 > run' h $ ex distance [unit Mile] (point (-73) 40) (point (-122) 37) 5460282596796 Optional argument for getNearest Optional argument for getNearest5Optional argument for getNearest, circle and distanceOptional argument for circle None!"35'(Apply a function to a list of arguments.Called do in the official drivers#run h $ (\x -> x R.* 2) `apply` [4]8( Evaluate a JavaScript expressionrun' h $ js "Math.PI"3.141592653589793'let r_sin x = js "Math.sin" `apply` [x]run h $ R.map r_sin [pi, pi/2] [1.2246...,1]Create a table on the server k>>> run' h $ tableCreate (table "posts") def [{"created":1}] >>> run' h $ tableCreate (table "users"){ tablePrimaryKey = Just "name" } def [{"created":1}] >>> run' h $ tableCreate (Table (Just "doctests") "bar" (Just "name")) def [{"created":1}] >>> run' h $ ex tableCreate ["datacenter":="orion"] (Table (Just "doctests") "bar" (Just "name")) def [{"created":1}]5Insert a document or a list of documents into a tablemrun h $ table "users" # insert (map (\x -> ["name":=x]) ["bill", "bob", "nancy" :: Text]) :: IO WriteResponse {inserted:3}mrun h $ table "posts" # insert ["author" := str "bill", "message" := str "hi", "id" := 1] :: IO WriteResponse {inserted:1}run h $ table "posts" # insert ["author" := str "bill", "message" := str "hello", "id" := 2, "flag" := str "deleted"] :: IO WriteResponse {inserted:1}run h $ table "posts" # insert ["author" := str "bob", "message" := str "lorem ipsum", "id" := 3, "flag" := str "pinned"] :: IO WriteResponse {inserted:1}+Add to or modify the contents of a documenturun h $ table "users" # getAll "name" [str "bob"] # update (const ["occupation" := str "tailor"]) :: IO WriteResponse {replaced:1}Replace a document with anotherrun h $ replace (\user -> ["name" := user!"name", "occupation" := str "clothier"]) . R.filter ((R.== str "tailor") . (!?"occupation")) $ table "users" :: IO WriteResponse {replaced:1}Delete the documentsNrun h $ delete . getAll "name" [str "bob"] $ table "users" :: IO WriteResponse {deleted:1} Like map but for write queries>_ <- run' h $ table "users" # replace (without ["post_count"])run h $ forEach (\user -> table "users" # get (user!"name") # ex update [nonAtomic] (const ["post_count" := R.count (table "posts" # R.filter (\post -> post!"author" R.== user!"name"))])) (table "users") :: IO WriteResponse {replaced:2} A table/fmap sort $ run h $ table "users" :: IO [Datum]@[{"post_count":2,"name":"bill"},{"post_count":0,"name":"nancy"}]  Drop a table run' h $ tableDrop (table "foo"){"config_changes":[{"new_val":null,"old_val":{"primary_key":"id","write_acks":"majority","durability":"hard","name":"foo","shards":...,"id":...,"db":"doctests"}}],"tables_dropped":1} List the tables in a database<fmap sort $ run h $ tableList (db "doctests") :: IO [String]["places","posts","users"] Addition or concatenation.Use the Num instance, or a qualified operator. run h $ 2 + 57run h $ str "foo" R.+ str "bar""foobar" Subtraction run h $ 2 - 5-3Multiplication run h $ 2 * 510Divisionrun h $ 2 R./ 50.4Modrun h $ 5 `mod` 21 Boolean orrun h $ True R.|| Falsetrue Boolean andrun h $ True R.&& FalsefalseTest for equality"run h $ ["a" := 1] R.== ["a" := 1]trueTest for inequalityrun h $ 1 R./= Falsetrue Greater thanrun h $ 3 R.> 2true Lesser thanrun h $ (str "a") R.< (str "b")trueGreater than or equal torun h $ [1] R.>= NullfalseLesser than or equal torun h $ 2 R.<= 2trueNegationrun h $ R.not Falsetruerun h $ R.not Nulltrue#The size of a sequence or an array.run h $ count (table "users")2Join two sequences./run h $ [1,2,3] `union` ["a", "b", "c" :: Text][1,2,3,"a","b","c"]Map a function over a sequence-run h $ R.map (!"a") [["a" := 1], ["a" := 2]][1,2]#Filter a sequence given a predicate1run h $ R.filter (R.< 4) [3, 1, 4, 1, 5, 9, 2, 6] [3,1,1,2]KQuery all the documents whose value for the given index is in a given rangeJrun h $ table "users" # between "name" (Closed $ str "a") (Open $ str "c") [{"post_count":2,"name":"bill"}] Append a datum to a sequencerun h $ append 3 [1, 2][1,2,3]!3Map a function of a sequence and concat the results*run h $ concatMap id [[1, 2], [3], [4, 5]] [1,2,3,4,5]"$SQL-like inner join of two sequencessorted $ run' h $ innerJoin (\user post -> user!"name" R.== post!"author") (table "users") (table "posts") # R.zip # orderBy [asc "id"] # pluck ["name", "message"]B[{"name":"bill","message":"hello"},{"name":"bill","message":"hi"}]#$SQL-like outer join of two sequencessorted $ run' h $ outerJoin (\user post -> user!"name" R.== post!"author") (table "users") (table "posts") # R.zip # orderBy [asc "id", asc "name"] # pluck ["name", "message"]S[{"name":"bill","message":"hello"},{"name":"bill","message":"hi"},{"name":"nancy"}]$\An efficient inner_join that uses a key for the left table and an index for the right table.sorted $ run' h $ table "posts" # eqJoin "author" (table "users") "name" # R.zip # orderBy [asc "id"] # pluck ["name", "message"]B[{"name":"bill","message":"hello"},{"name":"bill","message":"hi"}]%*Drop elements from the head of a sequence.run h $ skip 2 [1, 2, 3, 4][3,4]&Limit the size of a sequence.run h $ limit 2 [1, 2, 3, 4][1,2]'Cut out part of a sequence!run h $ slice 2 4 [1, 2, 3, 4, 5][3,4](#Reduce a sequence to a single valuerun h $ reduce0 (+) 0 [1, 2, 3]6)-Reduce a non-empty sequence to a single valuerun h $ reduce (+) [1, 2, 3]6*-Filter out identical elements of the sequenceDfmap sort $ run h $ distinct (table "posts" ! "flag") :: IO [String]["deleted","pinned"]+EMerge the "left" and "right" attributes of the objects in a sequence.`fmap sort $ run h $ table "posts" # eqJoin "author" (table "users") "name" # R.zip :: IO [Datum][{"post_count":2,"flag":"deleted","name":"bill","author":"bill","id":2,"message":"hello"},{"post_count":2,"name":"bill","author":"bill","id":1,"message":"hi"}],"Order a sequence by the given keys_run' h $ table "users" # orderBy [desc "post_count", asc "name"] # pluck ["name", "post_count"]@[{"post_count":2,"name":"bill"},{"post_count":0,"name":"nancy"}]Irun' h $ table "users" # ex orderBy ["index":="name"] [] # pluck ["name"]"[{"name":"bill"},{"name":"nancy"}]-Ascending order.Descending order/UTurn a grouping function and a reduction function into a grouped map reduce operationtrun' h $ table "posts" # orderBy [asc "id"] # group (!"author") (reduce (\a b -> a + "\n" + b) . R.map (!"message"))T[{"group":"bill","reduction":"hi\nhello"},{"group":"bob","reduction":"lorem ipsum"}]|run' h $ table "users" # group ((!0) . splitOn "" . (!"name")) (\users -> let pc = users!"post_count" in [avg pc, R.sum pc])A[{"group":"b","reduction":[2,2]},{"group":"n","reduction":[0,0]}]0>Rewrite multiple reductions into a single map/reduce operation1The sum of a sequencerun h $ sum [1, 2, 3]62The average of a sequencerun h $ avg [1, 2, 3, 4]2.53 Minimum value4!Value that minimizes the function5 Minimum value6%Floor rounds number to interger belowrun h $ R.floor 2.927#Ceil rounds number to integer aboverun h $ R.ceil 2.138&Round rounds number to nearest integerrun h $ R.round 2.539!Value that maximizes the function:;Get a single field from an object or an element of an arrayrun h $ ["foo" := True] ! "foo"truerun h $ [1, 2, 3] ! 010Or a single field from each object in a sequence3run h $ [["foo" := True], ["foo" := False]] ! "foo" [true,false];*Get a single field, or null if not presentrun' h $ empty !? "foo"null<Keep only the given attributesOrun' h $ [["a" := 1, "b" := 2], ["a" := 2, "c" := 7], ["b" := 4]] # pluck ["a"][{"a":1},{"a":2},{}]=*Remove the given attributes from an objectQrun' h $ [["a" := 1, "b" := 2], ["a" := 2, "c" := 7], ["b" := 4]] # without ["a"][{"b":2},{"c":7},{"b":4}]>+Test if a sequence contains a given elementrun' h $ [1,2,3] # contains 1true?Merge two objects together8run' h $ merge ["a" := 1, "b" := 1] ["b" := 1, "c" := 2]{"a":1,"b":1,"c":2}@ELiteral objects, in a merge or update, are not processed recursively.@run' h $ ["a" := ["b" := 1]] # merge ["a" := literal ["c" := 2]] {"a":{"c":2}}A*Remove fields when doing a merge or update4run' h $ ["a" := ["b" := 1]] # merge ["a" := remove]{}BServer-side ifrun h $ branch (1 R.< 2) 3 43CAbort the query with an error'run' h $ R.error (str "haha") R./ 2 + 1/*** Exception: RethinkDB: Runtime error: "haha"- in add(div({- HERE -} error("haha"), 2), 1)DCreate a Database referencerun' h $ db "test" # info${"name":"test","id":...,"type":"DB"}ECreate a database on the serverrun' h $ dbCreate "dev"W{"config_changes":[{"new_val":{"name":"dev","id":...},"old_val":null}],"dbs_created":1}FDrop a databaserun' h $ dbDrop (db "dev")j{"config_changes":[{"new_val":null,"old_val":{"name":"dev","id":...}}],"tables_dropped":0,"dbs_dropped":1}G List the databases on the server_ <- run' h $ dbListH4Create an index on the table from the given functionArun' h $ table "users" # indexCreate "occupation" (!"occupation") {"created":1}Nrun' h $ table "users" # ex indexCreate ["multi":=True] "friends" (!"friends") {"created":1}Nrun' h $ table "users" # ex indexCreate ["geo":=True] "location" (!"location") {"created":1}I#Get the status of the given indexes 'run' h $ table "users" # indexStatus []JWait for an index to be built %run' h $ table "users" # indexWait []LEEnsures that writes on a given table are written to permanent storagerun' h $ sync (table "users") {"synced":1}MList the indexes on the table"run' h $ indexList (table "users")#["friends","location","occupation"]N Drop an index/run' h $ table "users" # indexDrop "occupation" {"dropped":1}O)Retreive documents by their indexed value7run' h $ table "users" # getAll PrimaryKey [str "bill"] [{"post_count":2,"name":"bill"}]PGet a document by primary key$run' h $ table "users" # get "nancy"{"post_count":0,"name":"nancy"}Q#Convert a value to a different typerun h $ coerceTo "STRING" 1"1"RConvert a value to an array<run h $ asArray $ ["a" := 1, "b" := 2] :: IO [(String, Int)][("a",1),("b",2)]SConvert a value to a string'run h $ asString $ ["a" := 1, "b" := 2]"{\"a\":1,\"b\":2}"TConvert a value to a numberrun h $ asNumber (str "34")34UConvert a value to an object)run' h $ asObject $ [(str "a",1),("b",2)] {"a":1,"b":2}VConvert a value to a booleanW Like hasFields followed by pluckTrun' h $ [["a" := 1, "b" := 2], ["a" := 2, "c" := 7], ["b" := 4]] # withFields ["a"][{"a":1},{"a":2}]XEThe position in the sequence of the elements that match the predicate9run h $ indexesOf (match "ba.") [str "foo", "bar", "baz"][1,2]YTest if a sequence is emptyrun h $ isEmpty [1]falseZRSelect a given number of elements from a sequence with uniform random distribution,_ <- run' h $ sample 3 [0,1,2,3,4,5,6,7,8,9][Prepend an element to an arrayrun h $ prepend 1 [2,3][1,2,3]\The different of two lists&run h $ [1,2,3,4,5] # difference [2,5][1,3,4]]5Insert a datum into an array if it is not yet presentrun h $ setInsert 3 [1,2,4,4,5] [1,2,4,5,3]^The union of two setsrun h $ [1,2] `setUnion` [2,3][2,3,1]_The intersection of two sets%run h $ [1,2] `setIntersection` [2,3][2]`The difference of two sets#run h $ [2,3] # setDifference [1,2][3]a&Test if an object has the given fields"run h $ hasFields "a" $ ["a" := 1]trueb0Insert a datum at the given position in an arrayrun h $ insertAt 1 4 [1,2,3] [1,4,2,3]c8Splice an array at a given position inside another array run h $ spliceAt 2 [4,5] [1,2,3] [1,2,4,5,3]dDelete an element from an arrayrun h $ deleteAt 1 [1,2,3][1,3]eChange an element in an arrayrun h $ changeAt 1 4 [1,2,3][1,4,3]f$The list of keys of the given object!run h $ keys ["a" := 1, "b" := 2] ["a","b"]g&The list of values of the given object#run h $ values ["a" := 1, "b" := 2][1,2]h'Match a string to a regular expression.-run' h $ str "foobar" # match "f(.)+[bc](.+)"j{"groups":[{"start":2,"end":3,"str":"o"},{"start":4,"end":6,"str":"ar"}],"start":0,"end":6,"str":"foobar"}i'Catch some expections inside the query.Called default in the official drivers-run h $ R.handle (const 0) $ ["a" := 1] ! "b"0/run h $ R.handle (expr . id) $ ["a" := 1] ! "b"0"No attribute `b` in object:\n{\n\t\"a\":\t1\n}"j/A string representing the type of an expressionrun h $ typeOf 1"NUMBER"kGGet information on a given expression. Useful for tables and databases.run h $ info $ table "users"{"primary_key":"name","doc_count_estimates":...,"name":"users","id":...,"indexes":["friends","location"],"type":"TABLE","db":{"name":"doctests","id":...,"type":"DB"}}l"Parse a json string into an objectrun' h $ json "{\"a\":1}"{"a":1}mFlipped function applicationnConvert to upper caserun h $ upcase (str "Foo")"FOO"oConvert to lower caserun h $ downcase (str "Foo")"foo"p'Split a string on whitespace charactersrun' h $ split (str "foo bar") ["foo","bar"]q#Split a string on a given delimiter%run' h $ str "foo, bar" # splitOn ","["foo"," bar"]run' h $ str "foo" # splitOn "" ["f","o","o"]r,Split a string up to a given number of times'run' h $ str "a:b:c:d" # splitMax ":" 2["a","b","c:d"]sA random float between 0 and 17run' h $ (\x -> x R.< 1 R.&& x R.>= 0) `apply` [random]truetA random number between 0 and n=run' h $ (\x -> x R.< 10 R.&& x R.>= 0) `apply` [randomTo 10]trueuA random number between 0 and nCrun' h $ (\x -> x R.< 10 R.&& x R.>= 5) `apply` [randomFromTo 5 10]truev.Retrieve data from the specified URL over HTTPQ_ <- run' h $ http "http://httpbin.org/get" def{ httpParams = Just ["foo" := 1] }q_ <- run' h $ http "http://httpbin.org/put" def{ httpMethod = Just PUT, httpData = Just $ expr ["foo" := "bar"] }w-Splice a list of values into an argument listxDReturn an infinite stream of objects representing changes to a table>cursor <- run h $ table "posts" # changes :: IO (Cursor Datum)frun h $ table "posts" # insert ["author" := "bill", "message" := "bye", "id" := 4] :: IO WriteResponse {inserted:1} next cursorHJust {"new_val":{"author":"bill","id":4,"message":"bye"},"old_val":null}yOOptional argument for returning an array of objects describing the changes made[run h $ table "users" # ex insert [returnChanges] ["name" := "sabrina"] :: IO WriteResponseD{inserted:1,changes:[{"old_val":null,"new_val":{"name":"sabrina"}}]}zOptional argument for changes{Optional argument for changes|,Optional argument for soft durability writes}'Optional argument for non-atomic writesRrun' h $ table "users" # get "sabrina" # update (merge ["lucky_number" := random])~*** Exception: RethinkDB: Runtime error: "Could not prove argument deterministic. Maybe you want to use the non_atomic flag?" in {- HERE -} update(5 get(table(db("doctests"), "users"), "sabrina"),1 (\b -> merge(b, {lucky_number: random()})))trun h $ table "users" # get "sabrina" # ex update [nonAtomic] (merge ["lucky_number" := random]) :: IO WriteResponse {replaced:1}Generate a UUID run h uuid"...-...-...-..."Generate a Version 5 UUIDrun h $ uuid5 "foo"&"aa32a020-8c2d-5ff1-823b-ad3fa5d067eb" Generate numbers starting from 0run h $ range 10[0,1,2,3,4,5,6,7,8,9]Generate numbers within a rangerun h $ rangeFromTo 2 4[2,3] Generate numbers starting from 0run' h $ rangeAll # limit 4 [0,1,2,3]Wait for tables to be readyrun h $ table "users" # wait {"ready":1}+Convert an object or value to a JSON stringrun h $ toJSON "a""\"a\""Map over two sequencesrun h $ zipWith (+) [1,2] [3,4][4,6]Map over multiple sequencesBrun' h $ zipWithN (\a b c -> expr $ a + b * c) [[1,2],[3,4],[5,6]][16,26]Change a table's configuration'run h $ table "users" # reconfigure 2 1{{"config_changes":[{"new_val":{"primary_key":"name","write_acks":"majority","durability":"hard","name":"users","shards":...Rebalance a table's shards!run h $ table "users" # rebalanceo{"rebalanced":1,"status_changes":[{"new_val":{"status":{"all_replicas_ready":...,"ready_for_outdated_reads":...&Get the config for a table or databaserun h $ table "users" # configw{"primary_key":"name","write_acks":"majority","durability":"hard","name":"users","shards":...,"id":...,"db":"doctests"}Get the status of a tablerun h $ table "users" # statusH{"status":{"all_replicas_ready":true,"ready_for_outdated_reads":true,...'(      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'(      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@A(BCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh'ijklmnopqrstuvwxyz{|}~'(       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ : mNoneE      !"#%&'()*+,-./:;ABCDIcdhiklmnopqswxyz{|      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~G&     wxyz{|mnopqs!"#EFG   HNMKIJxz{Ly}|~D POhi)*,-./+++"#$+W!,-.%&'XYZ/)(*>0123549<=? [\]^_`:;abcdefg@AABCDhnopqr stu678w'(B Ci%:;QRSTUVjklvIcdmlkNone+      !"#%&'()*+,-./:;ABCDIcdhiklmnopqswxyz{|     "#$%&'()*,-./0249:;<=>?@ABDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~NoneGTakes a function that takes a sequence as an argument, and returns a function that only uses that sequence once, by merging the map and reduce operations. This is used by groupBy.A built-in map operationRA Chain of ReQL expressions that might be transformed into a map/reduce operation-A constant, not really a map/reduce operation Just a map*map/reduce operations represented as partsA rewritten map/reduce"Special cases for reduce with baseERepresents a map/reduce operation split into its map and reduce parts.Compares the two representations of a variable9notNone checks that it is a map/reduce and not a constant2Helper function for casting up from Term into ReQL@Build a single argument function from a constant ReQL expression=Build a two argument function from a constant ReQL expression)Convert a Chain back into a ReQL function#Convert an MRF into a ReQL functiontRewrites the term in the second argument to merge all uses of the variable whose id is given in the first argument./Chain a ReQL command onto a MapReduce operation*Convert some builtin operations into a map9Convert some of the built-in operations into a map/reduce TODO: these have not been tested,Convert from one representation to the otherWThis undocumented optional argument circumvents stream polymorphism on some operations$Rewrite a command into a map/reduce.QThis is a special case for when only one of the arguments is itself a map/reducepRewrite a command that combines the result of multiple map/reduce operations into a single map/reduce operationExtract the inner map/reduce objects, also returning a function which, given the result of all the map/reduce operations, returns the result of the given command111"None3      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#%&'()*+,-./:;ABCDIcdhiklmnopqswxyz{|     "#$%&'()*,-./0249:;<=>?@ABDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~           !"#$%&'() * + * , , - . / 0 0 1 2 3 4 5 6 7 8 9 : ; < = > > ? @ A B C D D E F G H H I J K L M N O P Q R S T U U V W X Y Z Z [ \ ]  ^ _ ` a 4 b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~ ~                                            -    l                                                       ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~                             ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { { | | } y ~                           >&                1 / 3 !"#$%&'() * + , -./0123456789:;<=:>:?(@ABCDEFGHI,JKLMNOPQRSTUVUWUXUYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  13  0.rethi_EmzJ4rdoKFFDHp9vY6tDGoDatabase.RethinkDB.DatumDatabase.RethinkDBDatabase.RethinkDB.WireDatabase.RethinkDB.Wire.TermDatabase.RethinkDB.Wire.Query Database.RethinkDB.Wire.Response$Database.RethinkDB.Wire.VersionDummyDatabase.RethinkDB.Wire.DatumDatabase.RethinkDB.Wire.FrameDatabase.RethinkDB.TypesDatabase.RethinkDB.ReQLDatabase.RethinkDB.FunctionsDatabase.RethinkDB.NetworkDatabase.RethinkDB.DriverDatabase.RethinkDB.TimeDatabase.RethinkDB.GeospatialDatabase.RethinkDB.MapReduceDatabase.RethinkDB.DoctestDatabase.RethinkDB.NoClashaeson_2t03sZhvmlzHSWzoTbx1vWData.Aeson.Types.InternalparseSuccessErrorResultParserdatad_K91y8NcZUJI9yaBI61rgdDData.Default.Classdef WireValuetoWirefromWireTermTypeDATUM MAKE_ARRAYMAKE_OBJVAR JAVASCRIPTUUIDHTTPERROR IMPLICIT_VARDBTABLEGETGET_ALLEQNELTLEGTGENOTADDSUBMULDIVMODFLOORCEILROUNDAPPENDPREPEND DIFFERENCE SET_INSERTSET_INTERSECTION SET_UNIONSET_DIFFERENCESLICESKIPLIMIT OFFSETS_OFCONTAINS GET_FIELDKEYSVALUESOBJECT HAS_FIELDS WITH_FIELDSPLUCKWITHOUTMERGEBETWEEN_DEPRECATEDBETWEENREDUCEMAPFILTER CONCAT_MAPORDER_BYDISTINCTCOUNTIS_EMPTYUNIONNTHBRACKET INNER_JOIN OUTER_JOINEQ_JOINZIPRANGE INSERT_AT DELETE_AT CHANGE_AT SPLICE_AT COERCE_TOTYPE_OFUPDATEDELETEREPLACEINSERT DB_CREATEDB_DROPDB_LIST TABLE_CREATE TABLE_DROP TABLE_LISTCONFIGSTATUSWAIT RECONFIGURE REBALANCESYNC INDEX_CREATE INDEX_DROP INDEX_LIST INDEX_STATUS INDEX_WAIT INDEX_RENAMEFUNCALLBRANCHORANDFOR_EACHFUNCASCDESCINFOMATCHUPCASEDOWNCASESAMPLEDEFAULTJSONTO_JSON_STRINGISO8601 TO_ISO8601 EPOCH_TIME TO_EPOCH_TIMENOW IN_TIMEZONEDURINGDATE TIME_OF_DAYTIMEZONEYEARMONTHDAY DAY_OF_WEEK DAY_OF_YEARHOURSMINUTESSECONDSTIMEMONDAYTUESDAY WEDNESDAYTHURSDAYFRIDAYSATURDAYSUNDAYJANUARYFEBRUARYMARCHAPRILMAYJUNEJULYAUGUST SEPTEMBEROCTOBERNOVEMBERDECEMBERLITERALGROUPSUMAVGMINMAXSPLITUNGROUPRANDOMCHANGESARGSBINARYGEOJSON TO_GEOJSONPOINTLINEPOLYGONDISTANCE INTERSECTSINCLUDESCIRCLEGET_INTERSECTINGFILL GET_NEAREST POLYGON_SUBMINVALMAXVAL$fWireValueTermType QueryTypeSTARTCONTINUESTOP NOREPLY_WAIT SERVER_INFO$fWireValueQueryType ResponseNote SEQUENCE_FEED ATOM_FEEDORDER_BY_LIMIT_FEED UNIONED_FEEDINCLUDES_STATES ErrorTypeINTERNALRESOURCE_LIMIT QUERY_LOGIC NON_EXISTENCE OP_FAILEDOP_INDETERMINATEUSER ResponseType SUCCESS_ATOMSUCCESS_SEQUENCESUCCESS_PARTIAL WAIT_COMPLETE CLIENT_ERROR COMPILE_ERROR RUNTIME_ERROR$fWireValueResponseNote$fWireValueErrorType$fWireValueResponseTypeProtocolPROTOBUFVersionV0_1V0_2V0_3V0_4$fWireValueProtocol$fWireValueVersion DatumTypeR_NULLR_BOOLR_NUMR_STRR_ARRAYR_OBJECTR_JSON$fWireValueDatumType FrameTypePOSOPT$fWireValueFrameTypeToDatumtoDatumLonLat longitudelatitude GeoPolygongeoPolygonLinesGeoLine geoLinePointsObjectArray FromDatum parseDatumDatumNullBoolStringNumberTimePointLinePolygonBinary fromDatum.=.:.:?encodedecode eitherDecode resultToMayberesultToEitherobjectIndex PrimaryKeyTable tableDatabase tableNametablePrimaryKeyDatabase databaseNameKeyExprReQLapplyjsBoundOpengetBoundClosed DefaultBoundMinValMaxVal WireBacktrace backtraceJSONFrameFramePosFrameOpt Backtrace WireQuery queryJSONexprexprList TermAttributeDynamicStaticOptArg Attribute:=::= NoAttributeArrarr baseArrayOptArgsex QuerySettings queryTokenqueryDefaultDatabase queryVarIndex queryReadModeTermtermTypetermArgs termOptArgs termDatumNotetermNotetermTermrunReQLwithQuerySettingsnewVarIdcons?:=op'op datumTermstrnum buildQuery reqlToDatumconvertBacktraceminvalmaxval closedOrOpenemptynote ErrorCodeErrorBrokenClient ErrorBadQuery ErrorRuntimeErrorUnexpectedResponseMoreResponse ResponseErrorResponseSingle ResponseBatchRethinkDBError errorCode errorTerm errorMessageerrorBacktraceRethinkDBConnectionErrorCursor cursorMBox cursorBuffer cursorMapRethinkDBHandle rdbSocket rdbWriteLockrdbToken rdbDatabaserdbWait rdbThreadconnect runQLQueryuseclose nextResponse makeCursornext nextBatchcollectcollect' noReplyWaiteach serverInfoChangeoldValnewVal WriteResponsewriteResponseInsertedwriteResponseDeletedwriteResponseReplacedwriteResponseUnchangedwriteResponseSkippedwriteResponseErrorswriteResponseFirstErrorwriteResponseGeneratedKeyswriteResponseChanges convertResultRunFlag UseOutdatedReadModeNoReply DurabilityProfile ArrayLimitrunOptsrunrun'nowtime epochTimeiso8601 inTimezoneduringtimezonedate timeOfDayyearmonthday dayOfWeek dayOfYearhoursminutesseconds toIso8601 toEpochTimeUnitMeter KilometerMile NauticalMileFootfillgeoJSON toGeoJSONgetIntersecting getNearestincludes intersectslinepointpolygon polygonSubcircledistance maxResultsmaxDistunit numVertices $fExprUnittermToMapReduceConflictResolutionReplaceUpdateHardSoftPaginationStrategyLinkNextPaginationFunction HttpMethodPOSTPUTPATCHHEADHttpResultFormat FormatAuto FormatJSON FormatJSONP FormatBinary HttpOptions httpTimeouthttpReattempts httpRedirects httpVerifyhttpResultFormat httpMethodhttpAuth httpParams httpHeaderhttpDatahttpPage httpPageLimit tableCreateinsertupdatereplacedeleteforEachtable tableDrop tableList+-*/mod||&&==/=><>=<=notcountunionmapfilterbetweenappend concatMap innerJoin outerJoineqJoinskiplimitslicereduce0reducedistinctziporderByascdescgroup mapReducesumavgminargminmaxfloorceilroundargmax!!?pluckwithoutcontainsmergeliteralremovebrancherrordbdbCreatedbDropdbList indexCreate indexStatus indexWait indexRenamesync indexList indexDropgetAllgetcoerceToasArrayasStringasNumberasObjectasBool withFields indexesOfisEmptysampleprepend difference setInsertsetUnionsetIntersection setDifference hasFieldsinsertAtspliceAtdeleteAtchangeAtkeysvaluesmatchhandletypeOfinfojson#upcasedowncasesplitsplitOnsplitMaxrandomrandomTo randomFromTohttpargschanges returnChanges includeStatesincludeInitial durability nonAtomicconflictuuiduuid5range rangeFromTorangeAllwaittoJSONzipWithzipWithN reconfigure rebalanceconfigstatus$fExprConflictResolution$fExprDurability$fDefaultHttpOptions$fExprPaginationStrategy$fExprHttpMethod$fExprHttpResultFormatReduce BuiltInReduceMapFun ConcatMapFunMap BuiltInMapChainNoneMapReduceChain MapReduceSingletonArrayAddBaseMRF _mrfMapFun _mrfReduceFun_mrfBase _mrfFinallysameVarnotConstwraptoFun1toFun2 applyChainapplyMRF applyMapsapplyMap applyMapFun applyReduce chainToMRF thenFinallythenMRF composeMaps composeMapFun thenReduce toMapReduce singletonmrChainmapMRF reduceMRFbaseAttrToOptArg noRecurserewrite1rewritexextracttry'doctestConnectsorted errorExpected showLonLat showDouble toJSONDatum pointToPair parseTimeZone $fOrdDatum $fToJSONDatum$fFromJSONDatum$fToDatumFloat$fToDatumDouble $fToDatumBool $fToDatumText$fToDatumText0$fToDatumInteger $fToDatum[] $fToDatumChar$fToDatumWord64$fToDatumWord32$fToDatumWord16$fToDatumWord8 $fToDatumWord$fToDatumInt64$fToDatumInt32$fToDatumInt16 $fToDatumInt8 $fToDatumInt$fToDatumValue$fToDatumLonLat$fToDatumRatio $fToDatumSet$fToDatumMaybe$fToDatumByteString$fToDatumByteString0$fToDatumEither$fToDatumUTCTime$fToDatumZonedTime $fToDatumMap $fToDatumMap0$fToDatumHashMap$fToDatumHashMap0$fToDatum(,,,,)$fToDatum(,,,) $fToDatum(,,) $fToDatum(,) $fToDatum()$fToDatumDatum$fToDatumVector $fToDatum[]0 $fShowDatum $fShowLonLat $fEqDatum$fFromDatumRatio$fFromDatumText$fFromDatumText0$fFromDatumInteger$fFromDatumChar$fFromDatumValue$fFromDatumBool$fFromDatumDouble$fFromDatumWord64$fFromDatumWord32$fFromDatumWord16$fFromDatumWord8$fFromDatumWord$fFromDatumInt64$fFromDatumInt32$fFromDatumInt16$fFromDatumInt8$fFromDatumInt $fFromDatum[]$fFromDatumFloat$fFromDatumLonLat$fFromDatumGeoPolygon$fFromDatumGeoLine$fFromDatumVector$fFromDatumUTCTime$fFromDatumZonedTime$fFromDatumSet$fFromDatumMaybe$fFromDatumMap$fFromDatumMap0$fFromDatumHashMap$fFromDatumHashMap0$fFromDatumByteString$fFromDatumByteString0$fFromDatumEither$fFromDatum(,,,,)$fFromDatum(,,,)$fFromDatum(,,)$fFromDatum(,) $fFromDatum()$fFromDatumDatum$fFromDatum[]0$fIsStringIndex$fIsStringTable $fShowTable$fIsStringDatabase$fShowDatabaseArgListWireTermtermJSON shortLinesvarNamemapTermAttributebaseAttributesargListtoIntstoIntvarsOfvarOf alphaRenameupdateChildren buildTerm complexDatumencodeTextJSONbuildAttributesboundOp$fFloatingReQL$fFractionalReQL $fExpr(,,,,) $fExpr(,,,) $fExpr(,,) $fExpr(,) $fNumBound$fFunctorBound $fExprBound $fExprTerm$fExprZonedTime $fExprUTCTime$fFromDatumFrame $fShowFrame $fShowReQL $fExprHashMap $fExprArgList$fExpr[]$fExprDatabase $fExprTable $fExpr(->) $fExpr(->)0 $fExpr(->)1 $fExpr(->)2 $fExpr(->)3 $fExprLonLat $fExprRatio $fExprWord64 $fExprWord32 $fExprWord16 $fExprWord8 $fExprWord$fExprByteString$fExprByteString0 $fExprText $fExprText0 $fExprInt64 $fExprInt32 $fExprInt16 $fExprInt8 $fExprFloat$fExpr() $fExprDouble $fExprDatum $fExprBool $fExprInteger $fExprInt $fExprValue $fExprVector $fExprSet $fExprMaybe $fExprMap $fExprMap0$fExprHashMap0$fExprHashMap1 $fExprEither $fExprChar $fExprReQL$fIsStringReQL $fNumReQL$fShowTermAttribute$fExprAttribute $fArrArgList $fArr(,,,) $fArr(,,)$fArr(,)$fArr[]$fArr()$fMonoidArgList $fShowTerm $fOptArgs(->) $fOptArgsReQL$fDefaultQuerySettingsRethinkDBReadError WireResponse_responseDatum _moreFeed _moreHandle _moreTokenTokennewToken getAddrFamily connectTorecvAllsGetNullTerminatedString magicNumber withSocketconvertResponseisNoReplyQueryaddMBox sendQLQuery readResponsesreadSingleResponseisLastResponse closeTokencursorFetchBatch$fExceptionRethinkDBReadError$fShowResponse$fShowErrorCode$fShowRethinkDBError$fExceptionRethinkDBError#$fExceptionRethinkDBConnectionError$fShowRethinkDBHandle$fFunctorCursorMajoritySingleOutdated renderOptionunsafeFromDatumnextFail assertEnd$fShowWriteResponse$fFromDatumWriteResponse$fFromDatumChange $fShowChange$fResultWriteResponse $fResultDatum$fResult(,,,,) $fResult(,,,) $fResult(,,) $fResult(,)$fResultLonLat $fResultRatio $fResultMap $fResultMap0$fResultHashMap$fResultHashMap0$fResultVector $fResultSet$fResultUTCTime$fResultZonedTime $fResultText $fResultText0$fResultByteString$fResultByteString0$fResultInteger$fResultWord64$fResultWord32$fResultWord16 $fResultWord8 $fResultWord $fResultInt64 $fResultInt32 $fResultInt16 $fResultInt8 $fResultFloat $fResultChar $fResultValue $fResult() $fResultBool$fResultDouble $fResultInt $fResultMaybe$fResultEither $fResult[]$fResultCursor$fResultResponsebaseGHC.Base++GHC.Errghc-primGHC.PrimseqGHC.List System.IOprint Data.Tuplefstsnd otherwise$ undefinedGHC.Num fromIntegerGHC.Real fromRationalGHC.EnumenumFrom enumFromThen enumFromToenumFromThenTo GHC.Classesnegatefail>>=>>fmapreturn fromIntegral realToFrac toInteger toRational<*>pureBoundedEnumEq GHC.FloatFloating FractionalIntegralMonadFunctorNumOrdGHC.ReadReadReal RealFloatRealFracGHC.ShowShow Applicative Data.FoldableFoldableData.Traversable Traversable GHC.TypesCharDoubleFloatInt integer-gmpGHC.Integer.TypeIntegerOrderingRationalIOWord Data.EitherEitherFalseTrueLeftRightJust Data.Functor<$>text_5c7VCmRXJenGcMPs3kwpkIData.Text.InternalTextMaybeNothing<**> Text.ReadreadsequencemapM sequenceAtraversereadIOreadLn appendFile writeFilereadFileinteract getContentsgetLinegetCharputStrLnputStrputCharGHC.IO.ExceptionioErrorGHC.IOFilePath userErrorIOErrorreadsnotElemallanyorandconcat sequence_mapM_productminimummaximumelemlengthnullfoldl1foldr1foldlfoldrfoldMapeither Data.OldListunwordswordsunlineslineslex readParenreadList readsPrecatanhacoshasinhtanhcoshsinhatanacosasintancossinlogBase**sqrtlogexppiatan2isIEEEisNegativeZeroisDenormalized isInfiniteisNaN scaleFloat significandexponent encodeFloat decodeFloat floatRange floatDigits floatRadixText.ParserCombinators.ReadPReadSlcmgcd^^^oddevendivModquotRemdivremquotrecipceilingtruncateproperFractionmaxBoundminBoundfromEnumtoEnumpredsucc showParen showStringshowCharshowsShowSshowListshow showsPrecunzip3unzipzipWith3zip3!!lookupreversebreakspansplitAtdroptake dropWhile takeWhilecycle replicaterepeatiteratescanr1scanrscanl1scanlinitlasttailhead Data.MaybemapMaybe catMaybes listToMaybe maybeToList fromMaybefromJust isNothingisJustmaybeuncurrycurrysubtractsignumabsasTypeOfuntil$!flip.constid=<<mconcatmappendmemptyMonoid<$compare