# -*- coding: utf-8 -*-
# This file was generated by _scripts/gen_python.py from the rethinkdb documentation in http://github.com/rethinkdb/docs
# hash: "186fb20ea9911710e910acfab0f4f221d59d7c04"

import rethinkdb

docsSource = [

	(rethinkdb.net.Connection.close, b'conn.close(noreply_wait=True)\n\nClose an open connection.\n\nClosing a connection normally waits until all outstanding requests have finished and then frees any open resources associated with the connection. By passing `False` to the `noreply_wait` optional argument, the connection will be closed immediately, possibly aborting any outstanding noreply writes.\n\nA noreply query is executed by passing the `noreply` option to the [run](http://rethinkdb.com/api/python/run/) command, indicating that `run()` should not wait for the query to complete before returning. You may also explicitly wait for a noreply query to complete by using the [noreply_wait](http://rethinkdb.com/api/python/noreply_wait) command.\n\n*Example* Close an open connection, waiting for noreply writes to finish.\n\n    conn.close()\n\n*Example* Close an open connection immediately.\n\n    conn.close(noreply_wait=False)\n'),
	(rethinkdb.connect, b'r.connect(host="localhost", port=28015, db="test", auth_key="", timeout=20) -> connection\nr.connect(host) -> connection\n\nCreate a new connection to the database server. The keyword arguments are:\n\n- `host`: host of the RethinkDB instance. The default value is `localhost`.\n- `port`: the driver port, by default `28015`.\n- `db`: the database used if not explicitly specified in a query, by default `test`.\n- `user`: the user account to connect as (default `admin`).\n- `password`: the password for the user account to connect as (default `\'\'`, empty).\n- `timeout`: timeout period in seconds for the connection to be opened (default `20`).\n- `ssl`: a hash of options to support SSL connections (default `None`). Currently, there is only one option available, and if the `ssl` option is specified, this key is required:\n    - `ca_certs`: a path to the SSL CA certificate.\n\nIf the connection cannot be established, a `ReqlDriverError` exception will be thrown.\n\n<!-- break -->\n\nThe RethinkDB Python driver includes support for asynchronous connections using Tornado and Twisted. Read the asynchronous connections documentation for more information.\n\n*Example* Open a connection using the default host and port, specifying the default database.\n\n    conn = r.connect(db=\'marvel\')\n\n*Example* Open a new connection to the database.\n\n    conn = r.connect(host=\'localhost\',\n                     port=28015,\n                     db=\'heroes\')\n\n*Example* Open a new connection to the database, specifying a user/password combination for authentication.\n\n    conn = r.connect(host=\'localhost\',\n                     port=28015,\n                     db=\'heroes\',\n                     user=\'herofinder\',\n                     password=\'metropolis\')\n\n*Example* Open a new connection to the database using an SSL proxy.\n\n    conn = r.connect(host=\'localhost\',\n                     port=28015,\n                     auth_key=\'hunter2\',\n                     ssl={\'ca_certs\': \'/path/to/ca.crt\'})\n\n*Example* Use a `with` statement to open a connection and pass it to a block. Using this style, the connection will be automatically closed when execution reaches the end of the block.\n\n    with r.connect(db=\'marvel\') as conn:\n        r.table(\'superheroes\').run(conn)\n'),
	(rethinkdb.net.Connection.noreply_wait, b'conn.noreply_wait()\n\n`noreply_wait` ensures that previous queries with the `noreply` flag have been processed\nby the server. Note that this guarantee only applies to queries run on the given connection.\n\n*Example* We have previously run queries with the `noreply` argument set to `True`. Now\nwait until the server has processed them.\n\n    conn.noreply_wait()\n\n'),
	(rethinkdb, b'r -> r\n\nThe top-level ReQL namespace.\n\n*Example* Setup your top-level namespace.\n\n    import rethinkdb as r\n\n'),
	(rethinkdb.net.Connection.reconnect, b'conn.reconnect(noreply_wait=True)\n\nClose and reopen a connection.\n\nClosing a connection normally waits until all outstanding requests have finished and then frees any open resources associated with the connection. By passing `False` to the `noreply_wait` optional argument, the connection will be closed immediately, possibly aborting any outstanding noreply writes.\n\nA noreply query is executed by passing the `noreply` option to the [run](http://rethinkdb.com/api/python/run/) command, indicating that `run()` should not wait for the query to complete before returning. You may also explicitly wait for a noreply query to complete by using the [noreply_wait](http://rethinkdb.com/api/python/noreply_wait) command.\n\n*Example* Cancel outstanding requests/queries that are no longer needed.\n\n    conn.reconnect(noreply_wait=False)\n'),
	(rethinkdb.net.Connection.repl, b"conn.repl()\n\nSet the default connection to make REPL use easier. Allows calling\n`.run()` on queries without specifying a connection.\n\n__Note:__ Avoid using `repl` in application code. RethinkDB connection objects are not thread-safe, and calls to `connect` from multiple threads may change the global connection object used by `repl`. Applications should specify connections explicitly.\n\n*Example* Set the default connection for the REPL, then call\n`run()` without specifying the connection.\n\n    r.connect(db='marvel').repl()\n    r.table('heroes').run()\n"),
	(rethinkdb.ast.RqlQuery.run, b'query.run(conn[, options]) -> cursor\nquery.run(conn[, options]) -> object\n\nRun a query on a connection, returning either a single JSON result or\na cursor, depending on the query.\n\nThe optional arguments are:\n\n- `read_mode`: One of three possible values affecting the consistency guarantee for the query (default: `\'single\'`).\n    - `\'single\'` (the default) returns values that are in memory (but not necessarily written to disk) on the primary replica.\n    - `\'majority\'` will only return values that are safely committed on disk on a majority of replicas. This requires sending a message to every replica on each read, so it is the slowest but most consistent.\n    - `\'outdated\'` will return values that are in memory on an arbitrarily-selected replica. This is the fastest but least consistent.\n- `time_format`: what format to return times in (default: `\'native\'`).\n  Set this to `\'raw\'` if you want times returned as JSON objects for exporting.\n- `profile`: whether or not to return a profile of the query\'s\n  execution (default: `False`).\n- `durability`: possible values are `\'hard\'` and `\'soft\'`. In soft durability mode RethinkDB\nwill acknowledge the write immediately after receiving it, but before the write has\nbeen committed to disk.\n- `group_format`: what format to return `grouped_data` and `grouped_streams` in (default: `\'native\'`).\n  Set this to `\'raw\'` if you want the raw pseudotype.\n- `noreply`: set to `True` to not receive the result object or cursor and return immediately.\n- `db`: the database to run this query against as a string. The default is the database specified in the `db` parameter to [connect](http://rethinkdb.com/api/python/connect/) (which defaults to `test`). The database may also be specified with the [db](http://rethinkdb.com/api/python/db/) command.\n- `array_limit`: the maximum numbers of array elements that can be returned by a query (default: 100,000). This affects all ReQL commands that return arrays. Note that it has no effect on the size of arrays being _written_ to the database; those always have an upper limit of 100,000 elements.\n- `binary_format`: what format to return binary data in (default: `\'native\'`). Set this to `\'raw\'` if you want the raw pseudotype.\n- `min_batch_rows`: minimum number of rows to wait for before batching a result set (default: 8). This is an integer.\n- `max_batch_rows`: maximum number of rows to wait for before batching a result set (default: unlimited). This is an integer.\n- `max_batch_bytes`: maximum number of bytes to wait for before batching a result set (default: 1MB). This is an integer.\n- `max_batch_seconds`: maximum number of seconds to wait before batching a result set (default: 0.5). This is a float (not an integer) and may be specified to the microsecond.\n- `first_batch_scaledown_factor`: factor to scale the other parameters down by on the first batch (default: 4). For example, with this set to 8 and `max_batch_rows` set to 80, on the first batch `max_batch_rows` will be adjusted to 10 (80 / 8). This allows the first batch to return faster.\n\n*Example* Run a query on the connection `conn` and print out every\nrow in the result.\n\n    for doc in r.table(\'marvel\').run(conn):\n        print doc\n\n*Example* If you are OK with potentially out of date data from all\nthe tables involved in this query and want potentially faster reads,\npass a flag allowing out of date data in an options object. Settings\nfor individual tables will supercede this global setting for all\ntables in the query.\n\n    r.table(\'marvel\').run(conn, read_mode=\'outdated\')\n\n*Example* If you just want to send a write and forget about it, you\ncan set `noreply` to true in the options. In this case `run` will\nreturn immediately.\n\n    r.table(\'marvel\').run(conn, noreply=True)\n\n*Example* If you want to specify whether to wait for a write to be\nwritten to disk (overriding the table\'s default settings), you can set\n`durability` to `\'hard\'` or `\'soft\'` in the options.\n\n    r.table(\'marvel\')\n        .insert({ \'superhero\': \'Iron Man\', \'superpower\': \'Arc Reactor\' })\n        .run(conn, noreply=True, durability=\'soft\')\n\n*Example* If you do not want a time object to be converted to a\nnative date object, you can pass a `time_format` flag to prevent it\n(valid flags are "raw" and "native"). This query returns an object\nwith two fields (`epoch_time` and `$reql_type$`) instead of a native date\nobject.\n\n    r.now().run(conn, time_format="raw")\n\n*Example* Specify the database to use for the query.\n\n    for doc in r.table(\'marvel\').run(conn, db=\'heroes\'):\n        print doc\n\nThis is equivalent to using the `db` command to specify the database:\n\n    r.db(\'heroes\').table(\'marvel\').run(conn) ...\n\n*Example* Change the batching parameters for this query.\n\n    r.table(\'marvel\').run(conn, max_batch_rows=16, max_batch_bytes=2048)\n'),
	(rethinkdb.net.Connection.server, b'conn.server()\n\nReturn information about the server being used by a connection.\n\nThe `server` command returns either two or three fields:\n\n* `id`: the UUID of the server the client is connected to.\n* `proxy`: a boolean indicating whether the server is a RethinkDB proxy node.\n* `name`: the server name. If `proxy` is `True`, this field will not be returned.\n\n*Example* Return server information.\n\n    > conn.server()\n    \n    {\n        "id": "404bef53-4b2c-433f-9184-bc3f7bda4a15",\n        "name": "amadeus",\n        "proxy": False\n    }\n'),
	(rethinkdb.set_loop_type, b'r.set_loop_type(string)\n\nSet an asynchronous event loop model. There are two supported models:\n\n* `"tornado"`: use the Tornado web framework. Under this model, the connect and run commands will return Tornado `Future` objects.\n* `"twisted"`: use the Twisted networking engine. Under this model, the connect and run commands will return Twisted `Deferred` objects.\n\n*Example* Read a table\'s data using Tornado.\n\n    r.set_loop_type("tornado")\n    conn = r.connect(host=\'localhost\', port=28015)\n    \n    @gen.coroutine\n    def use_cursor(conn):\n        # Print every row in the table.\n        cursor = yield r.table(\'test\').order_by(index="id").run(yield conn)\n        while (yield cursor.fetch_next()):\n            item = yield cursor.next()\n            print(item)\n\nFor a longer discussion with both Tornado and Twisted examples, see the documentation article on Asynchronous connections.\n\n'),
	(rethinkdb.net.Connection.use, b"conn.use(db_name)\n\nChange the default database on this connection.\n\n*Example* Change the default database so that we don't need to\nspecify the database when referencing a table.\n\n    conn.use('marvel')\n    r.table('heroes').run(conn) # refers to r.db('marvel').table('heroes')\n"),
	(rethinkdb.ast.Table.config, b'table.config() -> selection&lt;object&gt;\ndatabase.config() -> selection&lt;object&gt;\n\nQuery (read and/or update) the configurations for individual tables or databases.\n\nThe `config` command is a shorthand way to access the `table_config` or `db_config` [System tables](http://rethinkdb.com/docs/system-tables/#configuration-tables). It will return the single row from the system that corresponds to the database or table configuration, as if [get](http://rethinkdb.com/api/python/get) had been called on the system table with the UUID of the database or table in question.\n\n*Example* Get the configuration for the `users` table.\n\n    r.table(\'users\').config().run(conn)\n\n<!-- stop -->\n\nExample return:\n\n    \n    {\n        "id": "31c92680-f70c-4a4b-a49e-b238eb12c023",\n        "name": "users",\n        "db": "superstuff",\n        "primary_key": "id",\n        "shards": [\n            {\n                "primary_replica": "a",\n                "replicas": ["a", "b"],\n                "nonvoting_replicas": []\n            },\n            {\n                "primary_replica": "d",\n                "replicas": ["c", "d"],\n                "nonvoting_replicas": []\n            }\n        ],\n        "indexes": [],\n        "write_acks": "majority",\n        "durability": "hard"\n    }\n\n*Example* Change the write acknowledgement requirement of the `users` table.\n\n    r.table(\'users\').config().update({\'write_acks\': \'single\'}).run(conn)\n'),
	(rethinkdb.grant, b'r.grant("username", {"permission": bool[, ...]}) -> object\ndb.grant("username", {"permission": bool[, ...]}) -> object\ntable.grant("username", {"permission": bool[, ...]}) -> object\n\nGrant or deny access permissions for a user account, globally or on a per-database or per-table basis.\n\nThere are four different permissions that can be granted to an account:\n\n* `read` allows reading the data in tables.\n* `write` allows modifying data, including inserting, replacing/updating, and deleting.\n* `connect` allows a user to open HTTP connections via the http command. This permission can only be granted in global scope.\n* `config` allows users to create/drop secondary indexes on a table and changing the cluster configuration; to create and drop tables, if granted on a database; and to create and drop databases, if granted globally.\n\nPermissions may be granted on a global scope, or granted for a specific table or database. The scope is defined by calling `grant` on its own (e.g., `r.grant()`, on a table (`r.table().grant()`), or on a database (`r.db().grant()`).\n\nThe `grant` command returns an object of the following form:\n\n    {\n        "granted": 1,\n        "permissions_changes": [\n            {\n                "new_val": { new permissions },\n                "old_val": { original permissions }\n            }\n        ]\n\nThe `granted` field will always be `1`, and the `permissions_changes` list will have one object, describing the new permissions values and the old values they were changed from (which may be `None`).\n\nPermissions that are not defined on a local scope will be inherited from the next largest scope. For example, a write operation on a table will first check if `write` permissions are explicitly set to `True` or `False` for that table and account combination; if they are not, the `write` permissions for the database will be used if those are explicitly set; and if neither table nor database permissions are set for that account, the global `write` permissions for that account will be used.\n\n__Note:__ For all accounts other than the special, system-defined `admin` account, permissions that are not explicitly set in any scope will effectively be `False`. When you create a new user account by inserting a record into the system table, that account will have _no_ permissions until they are explicitly granted.\n\nFor a full description of permissions, read Permissions and user accounts.\n\n*Example* Grant the `chatapp` user account read and write permissions on the `users` database.\n\n    > r.db(\'users\').grant(\'chatapp\', {\'read\': True, \'write\': True}).run(conn)\n    \n    {\n        "granted": 1,\n        "permissions_changes": [\n            {\n                "new_val": { "read": true, "write": true },\n                "old_val": { null }\n            }\n        ]\n\n*Example* Deny write permissions from the `chatapp` account for the `admin` table.\n\n    r.db(\'users\').table(\'admin\').grant(\'chatapp\', {\'write\': False}).run(conn)\n\nThis will override the `write: true` permissions granted in the first example, but for this table only. Other tables in the `users` database will inherit from the database permissions.\n\n*Example* Delete a table-level permission for the `chatapp` account.\n\n    r.db(\'users\').table(\'admin\').grant(\'chatapp\', {\'write\': None}).run(conn)\n\nBy specifying `None`, the table scope `write` permission is removed, and will again inherit from the next highest scope (database or global).\n\n*Example* Grant `chatapp` the ability to use HTTP connections.\n\n    r.grant(\'chatapp\', {\'connect\': True}).run(conn)\n\nThis grant can only be given on a global level.\n\n*Example* Grant a `monitor` account read-only access to all databases.\n\n    r.grant(\'monitor\', {\'read\': True}).run(conn)\n'),
	(rethinkdb.ast.Table.rebalance, b'table.rebalance() -> object\ndatabase.rebalance() -> object\n\nRebalances the shards of a table. When called on a database, all the tables in that database will be rebalanced.\n\nThe `rebalance` command operates by measuring the distribution of primary keys within a table and picking split points that will give each shard approximately the same number of documents. It won\'t change the number of shards within a table, or change any other configuration aspect for the table or the database.\n\nA table will lose availability temporarily after `rebalance` is called; use the [wait](http://rethinkdb.com/api/python/wait) command to wait for the table to become available again, or [status](http://rethinkdb.com/api/python/status) to check if the table is available for writing.\n\nRethinkDB automatically rebalances tables when the number of shards are increased, and as long as your documents have evenly distributed primary keys&mdash;such as the default UUIDs&mdash;it is rarely necessary to call `rebalance` manually. Cases where `rebalance` may need to be called include:\n\n* Tables with unevenly distributed primary keys, such as incrementing integers\n* Changing a table\'s primary key type\n* Increasing the number of shards on an empty table, then using non-UUID primary keys in that table\n\nThe [web UI](http://rethinkdb.com/docs/administration-tools/) (and the [info](http://rethinkdb.com/api/python/info) command) can be used to tell you when a table\'s shards need to be rebalanced.\n\nThe return value of `rebalance` is an object with two fields:\n\n* `rebalanced`: the number of tables rebalanced.\n* `status_changes`: a list of new and old table status values. Each element of the list will be an object with two fields:\n    * `old_val`: The table\'s [status](http://rethinkdb.com/api/python/status) value before `rebalance` was executed. \n    * `new_val`: The table\'s `status` value after `rebalance` was executed. (This value will almost always indicate the table is unavailable.)\n\nSee the [status](http://rethinkdb.com/api/python/status) command for an explanation of the objects returned in the `old_val` and `new_val` fields.\n\n*Example* Rebalance a table.\n\n    r.table(\'superheroes\').rebalance().run(conn)\n\n<!-- stop -->\n\nExample return:\n\n    {\n      "rebalanced": 1,\n      "status_changes": [\n        {\n          "old_val": {\n            "db": "database",\n            "id": "5cb35225-81b2-4cec-9eef-bfad15481265",\n            "name": "superheroes",\n            "shards": [\n              {\n                "primary_replica": "jeeves",\n                "replicas": [\n                  {\n                    "server": "jeeves",\n                    "state": "ready"\n                  }\n                ]\n              },\n              {\n                "primary_replica": "jeeves",\n                "replicas": [\n                  {\n                    "server": "jeeves",\n                    "state": "ready"\n                  }\n                ]\n              }\n            ],\n            "status": {\n              "all_replicas_ready": True,\n              "ready_for_outdated_reads": True,\n              "ready_for_reads": True,\n              "ready_for_writes": True\n            }\n          },\n          "new_val": {\n            "db": "database",\n            "id": "5cb35225-81b2-4cec-9eef-bfad15481265",\n            "name": "superheroes",\n            "shards": [\n              {\n                "primary_replica": "jeeves",\n                "replicas": [\n                  {\n                    "server": "jeeves",\n                    "state": "transitioning"\n                  }\n                ]\n              },\n              {\n                "primary_replica": "jeeves",\n                "replicas": [\n                  {\n                    "server": "jeeves",\n                    "state": "transitioning"\n                  }\n                ]\n              }\n            ],\n            "status": {\n              "all_replicas_ready": False,\n              "ready_for_outdated_reads": False,\n              "ready_for_reads": False,\n              "ready_for_writes": False\n            }\n          }\n    \n        }\n      ]\n    }\n'),
	(rethinkdb.ast.Table.reconfigure, b'table.reconfigure(shards=<s>, replicas=<r>[, primary_replica_tag=<t>, dry_run=False, nonvoting_replica_tags=None]) -> object\ndatabase.reconfigure(shards=<s>, replicas=<r>[, primary_replica_tag=<t>, dry_run=False, nonvoting_replica_tags=None]) -> object\ntable.reconfigure(emergency_repair=<option>, dry_run=False) -> object\n\nReconfigure a table\'s sharding and replication.\n\n* `shards`: the number of shards, an integer from 1-64. Required.\n* `replicas`: either an integer or a mapping object. Required.\n    * If `replicas` is an integer, it specifies the number of replicas per shard. Specifying more replicas than there are servers will return an error.\n    * If `replicas` is an object, it specifies key-value pairs of server tags and the number of replicas to assign to those servers: `{"tag1": 2, "tag2": 4, "tag3": 2, ...}`. For more information about server tags, read [Administration tools](http://rethinkdb.com/docs/administration-tools/).\n* `primary_replica_tag`: the primary server specified by its server tag. Required if `replicas` is an object; the tag must be in the object. This must *not* be specified if `replicas` is an integer.\n* `dry_run`: if `True` the generated configuration will not be applied to the table, only returned.\n* `nonvoting_replica_tags`: replicas with these server tags will be added to the `nonvoting_replicas` list of the resulting configuration. (See [failover](http://rethinkdb.com/docs/failover) for details about non-voting replicas.)\n* `emergency_repair`: Used for the Emergency Repair mode. See the separate section below.\n\nThe return value of `reconfigure` is an object with three fields:\n\n* `reconfigured`: the number of tables reconfigured. This will be `0` if `dry_run` is `True`.\n* `config_changes`: a list of new and old table configuration values. Each element of the list will be an object with two fields:\n    * `old_val`: The table\'s [config](http://rethinkdb.com/api/python/config) value before `reconfigure` was executed. \n    * `new_val`: The table\'s `config` value after `reconfigure` was executed.\n* `status_changes`: a list of new and old table status values. Each element of the list will be an object with two fields:\n    * `old_val`: The table\'s [status](http://rethinkdb.com/api/python/status) value before `reconfigure` was executed. \n    * `new_val`: The table\'s `status` value after `reconfigure` was executed.\n\nFor `config_changes` and `status_changes`, see the [config](http://rethinkdb.com/api/python/config) and [status](http://rethinkdb.com/api/python/status) commands for an explanation of the objects returned in the `old_val` and `new_val` fields.\n\nA table will lose availability temporarily after `reconfigure` is called; use the [wait](http://rethinkdb.com/api/python/wait) command to wait for the table to become available again, or [status](http://rethinkdb.com/api/python/status) to check if the table is available for writing.\n\n**Note:** Whenever you call `reconfigure`, the write durability will be set to `hard` and the write acknowledgments will be set to `majority`; these can be changed by using the `config` command on the table.\n\nIf `reconfigure` is called on a database, all the tables in the database will have their configurations affected. The return value will be an array of the objects described above, one per table.\n\nRead [Sharding and replication](http://rethinkdb.com/docs/sharding-and-replication/) for a complete discussion of the subject, including advanced topics.\n\n*Example* Reconfigure a table.\n\n    r.table(\'superheroes\').reconfigure(shards=2, replicas=1).run(conn)\n\n<!-- stop -->\n\nExample return:\n\n    {\n      "reconfigured": 1,\n      "config_changes": [\n        {\n          "new_val": {\n            "id": "31c92680-f70c-4a4b-a49e-b238eb12c023",\n            "name": "superheroes",\n            "db": "superstuff",\n            "primary_key": "id",\n            "shards": [\n              {\n                "primary_replica": "jeeves",\n                "replicas": ["jeeves", "alfred"],\n                "nonvoting_replicas": []\n              },\n              {\n                "primary_replica": "alfred",\n                "replicas": ["jeeves", "alfred"],\n                "nonvoting_replicas": []\n              }\n            ],\n            "indexes": [],\n            "write_acks": "majority",\n            "durability": "hard"\n          },\n          "old_val": {\n            "id": "31c92680-f70c-4a4b-a49e-b238eb12c023",\n            "name": "superheroes",\n            "db": "superstuff",\n            "primary_key": "id",\n            "shards": [\n              {\n                "primary_replica": "alfred",\n                "replicas": ["jeeves", "alfred"],\n                "nonvoting_replicas": []\n              }\n            ],\n            "indexes": [],\n            "write_acks": "majority",\n            "durability": "hard"\n          }\n        }\n      ],\n      "status_changes": [\n        {\n          "new_val": (status object),\n          "old_val": (status object)\n        }\n      ]\n    }\n\n*Example* Reconfigure a table, specifying replicas by server tags.\n\n    r.table(\'superheroes\').reconfigure(shards=2, replicas={\'wooster\': 1, \'wayne\': 1}, primary_replica_tag=\'wooster\').run(conn)\n    \n    {\n      "reconfigured": 1,\n      "config_changes": [\n        {\n          "new_val": {\n            "id": "31c92680-f70c-4a4b-a49e-b238eb12c023",\n            "name": "superheroes",\n            "db": "superstuff",\n            "primary_key": "id",\n            "shards": [\n              {\n                "primary_replica": "jeeves",\n                "replicas": ["jeeves", "alfred"],\n                "nonvoting_replicas": []\n              },\n              {\n                "primary_replica": "alfred",\n                "replicas": ["jeeves", "alfred"],\n                "nonvoting_replicas": []\n              }\n            ],\n            "indexes": [],\n            "write_acks": "majority",\n            "durability": "hard"\n          },\n          "old_val": {\n            "id": "31c92680-f70c-4a4b-a49e-b238eb12c023",\n            "name": "superheroes",\n            "db": "superstuff",\n            "primary_key": "id",\n            "shards": [\n              {\n                "primary_replica": "alfred",\n                "replicas": ["jeeves", "alfred"],\n                "nonvoting_replicas": []\n              }\n            ],\n            "indexes": [],\n            "write_acks": "majority",\n            "durability": "hard"\n          }\n        }\n      ],\n      "status_changes": [\n        {\n          "new_val": (status object),\n          "old_val": (status object)\n        }\n      ]\n    }\n\nRethinkDB supports automatic failover when more than half of the voting replicas for each shard of a table are still available (see the Failover documentation for more details). However, if half or more of the voting replicas for a shard are lost, failover will not happen automatically, leaving two options:\n\n* Bring enough of the missing servers back online to allow automatic failover\n* Use emergency repair mode to reconfigure the table\n\nThe `emergency_repair` argument is effectively a different command; when it is specified, no other arguments to `reconfigure` are allowed except for `dry_run`. When it\'s executed, each shard of the table is examined and classified into one of three categories:\n\n* **Healthy:** more than half of the shard\'s voting replicas are still available.\n* **Repairable:** the shard is not healthy, but has at least one replica, whether voting or non-voting, available.\n* **Beyond repair:** the shard has no replicas available.\n\nFor each repairable shard, `emergency_repair` will convert all unavailable voting replicas into non-voting replicas. If all the voting replicas were removed, an arbitrarily-chosen available non-voting replica will be converted into a voting replica. After this operation, all of the shard\'s available replicas will be voting replicas.\n\nSpecify `emergency_repair` with one of two string options:\n\n* `unsafe_rollback`: shards that are beyond repair will be left alone.\n* `unsafe_rollback_or_erase`: a shard that is beyond repair will be destroyed and recreated on an available server that holds another shard for that table.\n\nThe return value of `reconfigure` in emergency repair mode is the same as before. Examine the `config_changes` field to see the old and new configuration settings for the table. As in the normal mode, if you specify `emergency_repair` with `dry_run: True`, the table will not actually be reconfigured.\n\n__Note:__ `emergency_repair` may only be used on individual tables, not on databases. It cannot be used after the `db` command.\n\n*Example* Perform an emergency repair on a table.\n\n    r.table(\'superheroes\').reconfigure(emergency_repair=\'unsafe_rollback\').run(conn)\n'),
	(rethinkdb.ast.Table.status, b'table.status() -> selection&lt;object&gt;\n\nReturn the status of a table.\n\nThe return value is an object providing information about the table\'s shards, replicas and replica readiness states. For a more complete discussion of the object fields, read about the `table_status` table in [System tables](http://rethinkdb.com/docs/system-tables/#status-tables).\n\n* `id`: the UUID of the table.\n* `name`: the table\'s name.\n* `db`: the database the table is in.\n* `status`: the subfields in this field indicate whether all shards of the table are ready to accept the given type of query: `outdated_reads`, `reads` and `writes`. The `all_replicas_ready` field indicates whether all backfills have finished.\n* `shards`: one entry for each shard in `table_config`. Each shard\'s object has the following fields:\n\t* `primary_replicas`: a list of zero or more servers acting as primary replicas for the table.\n\t* `replicas`: a list of all servers acting as a replica for that shard. The `state` field may be one of the following: `ready`, `transitioning`, `backfilling`, `disconnected`, `waiting_for_primary`, or `waiting_for_quorum`.\n\n*Example* Get a table\'s status.\n\n    r.table(\'superheroes\').status().run(conn)\n\n<!-- stop -->\n\nExample return:\n\n    {\n      "db": "database",\n      "id": "5cb35225-81b2-4cec-9eef-bfad15481265",\n      "name": "superheroes",\n      "shards": [\n        {\n          "primary_replicas": ["jeeves"],\n          "replicas": [\n            {\n              "server": "jeeves",\n              "state": "ready"\n            }\n          ]\n        },\n        {\n          "primary_replicas": ["jeeves"],\n          "replicas": [\n            {\n              "server": "jeeves",\n              "state": "ready"\n            }\n          ]\n        }\n      ],\n      "status": {\n        "all_replicas_ready": True,\n        "ready_for_outdated_reads": True,\n        "ready_for_reads": True,\n        "ready_for_writes": True\n      }\n    }\n'),
	(rethinkdb.ast.Table.wait, b'table.wait([wait_for=\'ready_for_writes\', timeout=<sec>]) -> object\ndatabase.wait([wait_for=\'ready_for_writes\', timeout=<sec>]) -> object\nr.wait(table | database, [wait_for=\'ready_for_writes\', timeout=<sec>]) -> object\n\nWait for a table or all the tables in a database to be ready. A table may be temporarily unavailable after creation, rebalancing or reconfiguring. The `wait` command blocks until the given table (or database) is fully up to date.\n\nThe `wait` command takes two optional arguments:\n\n* `wait_for`: a string indicating a table [status](http://rethinkdb.com/api/python/status) to wait on before returning, one of `ready_for_outdated_reads`, `ready_for_reads`, `ready_for_writes`, or `all_replicas_ready`. The default is `ready_for_writes`. \n* `timeout`: a number indicating maximum time, in seconds, to wait for the table to be ready. If this value is exceeded, a `ReqlRuntimeError` will be thrown. A value of`0` means no timeout. The default is `0` (no timeout).\n\nThe return value is an object consisting of a single field, `ready`. The value is an integer indicating the number of tables waited for. It will always be `1` when `wait` is called on a table, and the total number of tables when called on a database.\n\n*Example* Wait on a table to be ready.\n\n    r.table(\'superheroes\').wait().run(conn)\n    \n    {"ready": 1}\n'),
	(rethinkdb.ast.RqlQuery.avg, b"sequence.avg([field | function]) -> number\n\nAverages all the elements of a sequence.  If called with a field name,\naverages all the values of that field in the sequence, skipping\nelements of the sequence that lack that field.  If called with a\nfunction, calls that function on every element of the sequence and\naverages the results, skipping elements of the sequence where that\nfunction returns `None` or a non-existence error.\n\nProduces a non-existence error when called on an empty sequence.  You\ncan handle this case with `default`.\n\n*Example* What's the average of 3, 5, and 7?\n\n    r.expr([3, 5, 7]).avg().run(conn)\n\n*Example* What's the average number of points scored in a game?\n\n    r.table('games').avg('points').run(conn)\n\n*Example* What's the average number of points scored in a game,\ncounting bonus points?\n\n    r.table('games').avg(lambda game:\n        game['points'] + game['bonus_points']\n    ).run(conn)\n\n*Example* What's the average number of points scored in a game?\n(But return `None` instead of raising an error if there are no games where\npoints have been scored.)\n\n    r.table('games').avg('points').default(None).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.contains, b"sequence.contains([value | predicate_function, ...]) -> bool\n\nWhen called with values, returns `True` if a sequence contains all the\nspecified values.  When called with predicate functions, returns `True`\nif for each predicate there exists at least one element of the stream\nwhere that predicate returns `True`.\n\nValues and predicates may be mixed freely in the argument list.\n\n*Example* Has Iron Man ever fought Superman?\n\n    r.table('marvel').get('ironman')['opponents'].contains('superman').run(conn)\n\n*Example* Has Iron Man ever defeated Superman in battle?\n\n    r.table('marvel').get('ironman')['battles'].contains(lambda battle:\n        (battle['winner'] == 'ironman') & (battle['loser'] == 'superman')\n    ).run(conn)\n\n*Example* Use `contains` with a predicate function to simulate an `or`. Return the Marvel superheroes who live in Detroit, Chicago or Hoboken.\n\n    r.table('marvel').filter(\n        lambda hero: r.expr(['Detroit', 'Chicago', 'Hoboken']).contains(hero['city'])\n    ).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.count, b"sequence.count([value | predicate_function]) -> number\nbinary.count() -> number\nstring.count() -> number\nobject.count() -> number\n\nCounts the number of elements in a sequence or key/value pairs in an object, or returns the size of a string or binary object.\n\nWhen `count` is called on a sequence with a predicate value or function, it returns the number of elements in the sequence equal to that value or where the function returns `True`. On a [binary](http://rethinkdb.com/api/python/binary) object, `count` returns the size of the object in bytes; on strings, `count` returns the string's length. This is determined by counting the number of Unicode codepoints in the string, counting combining codepoints separately.\n\n*Example* Count the number of users.\n\n    r.table('users').count().run(conn)\n\n*Example* Count the number of 18 year old users.\n\n    r.table('users')['age'].count(18).run(conn)\n\n*Example* Count the number of users over 18.\n\n    r.table('users')['age'].count(lambda age: age > 18).run(conn)\n\n    r.table('users').count(lambda user: user['age'] > 18).run(conn)\n\n*Example* Return the length of a Unicode string.\n\n    > r.expr(u'\xe3\x81\x93\xe3\x82\x93\xe3\x81\xab\xe3\x81\xa1\xe3\x81\xaf').count().run(conn)\n    5\n"),
	(rethinkdb.ast.RqlQuery.distinct, b"sequence.distinct() -> array\ntable.distinct([index=<indexname>]) -> stream\n\nRemoves duplicate elements from a sequence.\n\nThe `distinct` command can be called on any sequence or table with an index.\n\n*Example* Which unique villains have been vanquished by Marvel heroes?\n\n    r.table('marvel').concat_map(\n        lambda hero: hero['villain_list']).distinct().run(conn)\n\n*Example* Topics in a table of messages have a secondary index on them, and more than one message can have the same topic. What are the unique topics in the table?\n\n    r.table('messages').distinct(index='topics').run(conn)\n\nThe above structure is functionally identical to:\n\n    r.table('messages')['topics'].distinct().run(conn)\n\nHowever, the first form (passing the index as an argument to `distinct`) is faster, and won't run into array limit issues since it's returning a stream.\n"),
	(rethinkdb.ast.RqlQuery.fold, b"sequence.fold(base, function) -> value\nsequence.fold(base, function, emit=function[, final_emit=function]) -> sequence\n\nApply a function to a sequence in order, maintaining state via an accumulator. The `fold` command returns either a single value or a new sequence.\n\nIn its first form, `fold` operates like reduce, returning a value by applying a combining function to each element in a sequence, passing the current element and the previous reduction result to the function. However, `fold` has the following differences from `reduce`:\n\n* it is guaranteed to proceed through the sequence from first element to last.\n* it passes an initial base value to the function with the first element in place of the previous reduction result.\n\nIn its second form, `fold` operates like concat_map, returning a new sequence rather than a single value. When an `emit` function is provided, `fold` will:\n\n* proceed through the sequence in order and take an initial base value, as above.\n* for each element in the sequence, call both the combining function and a separate emitting function with the current element and previous reduction result.\n* optionally pass the result of the combining function to the emitting function.\n\nIf provided, the emitting function must return a list.\n\n*Example* Concatenate words from a list.\n\n    r.table('words').order_by('id').fold('',\n        lambda acc, word: acc + r.branch(acc == '', '', ', ') + word\n    ).run(conn)\n\n(This example could be implemented with `reduce`, but `fold` will preserve the order when `words` is a RethinkDB table or other stream, which is not guaranteed with `reduce`.)\n\n*Example* Return every other row in a table.\n\n    r.table('even_things').fold(0,\n        lambda acc, row: acc + 1,\n        emit=lambda acc, row: r.branch((acc % 2 == 0), [row], [])\n    ).run(conn)\n\nThe first function increments the accumulator each time it's called, starting at `0`; the second function, the emitting function, alternates between returning a single-item list containing the current row or an empty list. The `fold` command will return a concatenated list of each emitted value.\n\n*Example* Compute a five-day running average for a weight tracker.\n\n    r.table('tracker').filter({'name': 'bob'}).order_by('date')['weight'].fold(\n        [],\n        lambda acc, row: ([row] + acc).limit(5),\n        emit=lambda acc, row, new_acc: r.branch(new_acc.size() == 5, [new_acc.avg()], [])\n    ).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.group, b'sequence.group(field | function..., [index=<indexname>, multi=False]) -> grouped_stream\n\nTakes a stream and partitions it into multiple groups based on the\nfields or functions provided.\n\nWith the `multi` flag single documents can be assigned to multiple groups, similar to the behavior of [multi-indexes](http://rethinkdb.com/docs/secondary-indexes/python). When `multi` is `True` and the grouping value is an array, documents will be placed in each group that corresponds to the elements of the array. If the array is empty the row will be ignored.\n\nSuppose that the table `games` has the following data:\n\n    [\n        {"id": 2, "player": "Bob", "points": 15, "type": "ranked"},\n        {"id": 5, "player": "Alice", "points": 7, "type": "free"},\n        {"id": 11, "player": "Bob", "points": 10, "type": "free"},\n        {"id": 12, "player": "Alice", "points": 2, "type": "free"}\n    ]\n\n*Example* Group games by player.\n\n    > r.table(\'games\').group(\'player\').run(conn)\n    \n    {\n        "Alice": [\n            {"id": 5, "player": "Alice", "points": 7, "type": "free"},\n            {"id": 12, "player": "Alice", "points": 2, "type": "free"}\n        ],\n        "Bob": [\n            {"id": 2, "player": "Bob", "points": 15, "type": "ranked"},\n            {"id": 11, "player": "Bob", "points": 10, "type": "free"}\n        ]\n    }\n\n<!-- stop -->\n\nCommands chained after `group` will be called on each of these grouped\nsub-streams, producing grouped data.\n\n*Example* What is each player\'s best game?\n\n    > r.table(\'games\').group(\'player\').max(\'points\').run(conn)\n    \n    {\n        "Alice": {"id": 5, "player": "Alice", "points": 7, "type": "free"},\n        "Bob": {"id": 2, "player": "Bob", "points": 15, "type": "ranked"}\n    }\n\nCommands chained onto grouped data will operate on each grouped datum,\nproducing more grouped data.\n\n*Example* What is the maximum number of points scored by each player?\n\n    > r.table(\'games\').group(\'player\').max(\'points\')[\'points\'].run(conn)\n    \n    {\n        "Alice": 7,\n        "Bob": 15\n    }\n\nYou can also group by more than one field.\n\n*Example* What is the maximum number of points scored by each\nplayer for each game type?\n\n    > r.table(\'games\').group(\'player\', \'type\').max(\'points\')[\'points\'].run(conn)\n    \n    {\n        ("Alice", "free"): 7,\n        ("Bob", "free"): 10,\n        ("Bob", "ranked"): 15\n    }\n\nYou can also group by a function.\n\n*Example* What is the maximum number of points scored by each\nplayer for each game type?\n\n    > r.table(\'games\')\n        .group(lambda game:\n            game.pluck(\'player\', \'type\')\n        ).max(\'points\')[\'points\'].run(conn)\n    \n    {\n        frozenset([(\'player\', \'Alice\'), (\'type\', \'free\')]): 7,\n        frozenset([(\'player\', \'Bob\'), (\'type\', \'free\')]): 10,\n        frozenset([(\'player\', \'Bob\'), (\'type\', \'ranked\')]): 15,\n    }\n\nUsing a function, you can also group by date on a ReQL [date field](http://rethinkdb.com/docs/dates-and-times/javascript/).\n\n*Example* How many matches have been played this year by month?\n\n    > r.table(\'matches\').group(\n          lambda match: [match[\'date\'].year(), match[\'date\'].month()]\n      ).count().run(conn)\n    \n    {\n        (2014, 2): 2,\n        (2014, 3): 2,\n        (2014, 4): 1,\n        (2014, 5): 3\n    }\n\nYou can also group on an index (primary key or secondary).\n\n*Example* What is the maximum number of points scored by game type?\n\n    > r.table(\'games\').group(index=\'type\').max(\'points\')[\'points\'].run(conn)\n    \n    {\n        "free": 10,\n        "ranked": 15\n    }\n\nSuppose that the table `games2` has the following data:\n\n    [\n        { \'id\': 1, \'matches\': {\'a\': [1, 2, 3], \'b\': [4, 5, 6]} },\n        { \'id\': 2, \'matches\': {\'b\': [100], \'c\': [7, 8, 9]} },\n        { \'id\': 3, \'matches\': {\'a\': [10, 20], \'c\': [70, 80]} }\n    ]\n\nUsing the `multi` option we can group data by match A, B or C.\n\n    > r.table(\'games2\').group(r.row[\'matches\'].keys(), multi=True).run(conn)\n    \n    [\n        {\n            \'group\': \'a\',\n            \'reduction\': [ <id 1>, <id 3> ]\n        },\n        {\n            \'group\': \'b\',\n            \'reduction\': [ <id 1>, <id 2> ]\n        },\n        {\n            \'group\': \'c\',\n            \'reduction\': [ <id 2>, <id 3> ]\n        }\n    ]\n\n(The full result set is abbreviated in the figure; `<id 1>, <id 2>` and `<id 3>` would be the entire documents matching those keys.)\n\n*Example* Use [map](http://rethinkdb.com/api/python/map) and [sum](http://rethinkdb.com/api/python/sum) to get the total points scored for each match.\n\n    r.table(\'games2\').group(r.row[\'matches\'].keys(), multi=True).ungroup().map(\n        lambda doc: { \'match\': doc[\'group\'], \'total\': doc[\'reduction\'].sum(\n            lambda set: set[\'matches\'][doc[\'group\']].sum()\n        )}).run(conn)\n    \n    [\n        { \'match\': \'a\', \'total\': 36 },\n        { \'match\': \'b\', \'total\': 115 },\n        { \'match\': \'c\', \'total\': 174 }\n    ]\n\nThe inner `sum` adds the scores by match within each document; the outer `sum` adds those results together for a total across all the documents.\n\nIf you want to operate on all the groups rather than operating on each\ngroup (e.g. if you want to order the groups by their reduction), you\ncan use [ungroup](http://rethinkdb.com/api/python/ungroup/) to turn a grouped stream or\ngrouped data into an array of objects representing the groups.\n\n*Example* Ungrouping grouped data.\n\n    > r.table(\'games\').group(\'player\').max(\'points\')[\'points\'].ungroup().run(conn)\n    \n    [\n        {\n            "group": "Alice",\n            "reduction": 7\n        },\n        {\n            "group": "Bob",\n            "reduction": 15\n        }\n    ]\n\nUngrouping is useful e.g. for ordering grouped data, or for inserting\ngrouped data into a table.\n\n*Example* What is the maximum number of points scored by each\nplayer, with the highest scorers first?\n\n    > r.table(\'games\').group(\'player\').max(\'points\')[\'points\'].ungroup().order_by(\n            r.desc(\'reduction\')).run(conn)\n    \n    [\n        {\n            "group": "Bob",\n            "reduction": 15\n        },\n        {\n            "group": "Alice",\n            "reduction": 7\n        }\n    ]\n\nWhen grouped data are returned to the client, they are transformed\ninto a client-specific native type.  (Something similar is done with\n[times](http://rethinkdb.com/docs/dates-and-times/).)  In Python, grouped data are\ntransformed into a `dictionary`. If the group value is an `array`, the\nkey is converted to a `tuple`. If the group value is a `dictionary`,\nit will be converted to a `frozenset`.\n\nIf you instead want to receive the raw\npseudotype from the server (e.g. if you\'re planning to serialize the\nresult as JSON), you can specify `group_format: \'raw\'` as an optional\nargument to `run`:\n\n*Example* Get back the raw `GROUPED_DATA` pseudotype.\n\n    > r.table(\'games\').group(\'player\').avg(\'points\').run(conn, group_format=\'raw\')\n    \n    {\n        "$reql_type$": "GROUPED_DATA",\n        "data": [\n            ["Alice", 4.5],\n            ["Bob", 12.5]\n        ]\n    }\n\nNot passing the `group_format` flag would return:\n\n    {\n        "Alice": 4.5,\n        "Bob": 12.5\n    }\n\nYou might also want to use the [ungroup](http://rethinkdb.com/api/python/ungroup/)\ncommand (see above), which will turn the grouped data into an array of\nobjects on the server.\n\nIf you run a query that returns a grouped stream, it will be\nautomatically converted to grouped data before being sent back to you\n(there is currently no efficient way to stream groups from RethinkDB).\nThis grouped data is subject to the array size limit (see [run](http://rethinkdb.com/api/python/run)).\n\nIn general, operations on grouped streams will be efficiently\ndistributed, and operations on grouped data won\'t be.  You can figure\nout what you\'re working with by putting `type_of` on the end of your\nquery.  Below are efficient and inefficient examples.\n\n*Example* Efficient operation.\n\n    # r.table(\'games\').group(\'player\').type_of().run(conn)\n    # Returns "GROUPED_STREAM"\n    r.table(\'games\').group(\'player\').min(\'points\').run(conn) # EFFICIENT\n\n*Example* Inefficient operation.\n\n    # r.table(\'games\').group(\'player\').order_by(\'score\').type_of().run(conn)\n    # Returns "GROUPED_DATA"\n    r.table(\'games\').group(\'player\').order_by(\'score\').nth(0).run(conn) # INEFFICIENT\n\nWhat does it mean to be inefficient here?  When operating on grouped\ndata rather than a grouped stream, *all* of the data has to be\navailable on the node processing the query.  This means that the\noperation will only use one server\'s resources, and will require\nmemory proportional to the size of the grouped data it\'s operating\non.  (In the case of the [order_by](http://rethinkdb.com/api/python/order_by/) in the inefficient example, that\nmeans memory proportional **to the size of the table**.)  The array\nlimit is also enforced for grouped data, so the `order_by` example\nwould fail for tables with more than 100,000 rows unless you used the `array_limit` option with `run`.\n\n*Example* What is the maximum number of points scored by each\nplayer in free games?\n\n    > r.table(\'games\').filter(lambda game:\n            game[\'type\'] = \'free\'\n        ).group(\'player\').max(\'points\')[\'points\'].run(conn)\n    \n    {\n        "Alice": 7,\n        "Bob": 10\n    }\n\n*Example* What is each player\'s highest even and odd score?\n\n    > r.table(\'games\')\n        .group(\'name\', lambda game:\n            game[\'points\'] % 2\n        ).max(\'points\')[\'points\'].run(conn)\n    \n    {\n        ("Alice", 1): 7,\n        ("Bob", 0): 10,\n        ("Bob", 1): 15\n    }\n'),
	(rethinkdb.ast.RqlQuery.max, b"sequence.max(field | function) -> element\nsequence.max(index=<indexname>) -> element\n\nFinds the maximum element of a sequence.\n\nThe `max` command can be called with:\n\n* a **field name**, to return the element of the sequence with the largest value in that field;\n* an **index** (the primary key or a secondary index), to return the element of the sequence with the largest value in that index;\n* a **function**, to apply the function to every element within the sequence and return the element which returns the largest value from the function, ignoring any elements where the function produces a non-existence error.\n\nFor more information on RethinkDB's sorting order, read the section in [ReQL data types](http://rethinkdb.com/docs/data-types/#sorting-order).\n\nCalling `max` on an empty sequence will throw a non-existence error; this can be handled using the [default](http://rethinkdb.com/api/python/default/) command.\n\n*Example* Return the maximum value in the list `[3, 5, 7]`.\n\n    r.expr([3, 5, 7]).max().run(conn)\n\n*Example* Return the user who has scored the most points.\n\n    r.table('users').max('points').run(conn)\n\n*Example* The same as above, but using a secondary index on the `points` field.\n\n    r.table('users').max(index='points').run(conn)\n\n*Example* Return the user who has scored the most points, adding in bonus points from a separate field using a function.\n\n    r.table('users').max(lambda user:\n        user['points'] + user['bonus_points']\n    ).run(conn)\n\n*Example* Return the highest number of points any user has ever scored. This returns the value of that `points` field, not a document.\n\n    r.table('users').max('points')['points'].run(conn)\n\n*Example* Return the user who has scored the most points, but add a default `None` return value to prevent an error if no user has ever scored points.\n\n    r.table('users').max('points').default(None).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.min, b"sequence.min(field | function) -> element\nsequence.min(index=<indexname>) -> element\n\nFinds the minimum element of a sequence.\n\nThe `min` command can be called with:\n\n* a **field name**, to return the element of the sequence with the smallest value in that field;\n* an **index** (the primary key or a secondary index), to return the element of the sequence with the smallest value in that index;\n* a **function**, to apply the function to every element within the sequence and return the element which returns the smallest value from the function, ignoring any elements where the function produces a non-existence error.\n\nFor more information on RethinkDB's sorting order, read the section in [ReQL data types](http://rethinkdb.com/docs/data-types/#sorting-order).\n\nCalling `min` on an empty sequence will throw a non-existence error; this can be handled using the [default](http://rethinkdb.com/api/python/default/) command.\n\n*Example* Return the minimum value in the list `[3, 5, 7]`.\n\n    r.expr([3, 5, 7]).min().run(conn)\n\n*Example* Return the user who has scored the fewest points.\n\n    r.table('users').min('points').run(conn)\n\n*Example* The same as above, but using a secondary index on the `points` field.\n\n    r.table('users').min(index='points').run(conn)\n\n*Example* Return the user who has scored the fewest points, adding in bonus points from a separate field using a function.\n\n    r.table('users').min(lambda user:\n        user['points'] + user['bonus_points']\n    ).run(conn)\n\n*Example* Return the smallest number of points any user has ever scored. This returns the value of that `points` field, not a document.\n\n    r.table('users').min('points')['points'].run(conn)\n\n*Example* Return the user who has scored the fewest points, but add a default `None` return value to prevent an error if no user has ever scored points.\n\n    r.table('users').min('points').default(None).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.reduce, b'sequence.reduce(function) -> value\n\nProduce a single value from a sequence through repeated application of a reduction function.\n\nThe reduction function can be called on:\n\n- two elements of the sequence\n- one element of the sequence and one result of a previous reduction\n- two results of previous reductions\n\nThe reduction function can be called on the results of two previous reductions because the\n`reduce` command is distributed and parallelized across shards and CPU cores. A common\nmistaken when using the `reduce` command is to suppose that the reduction is executed\nfrom left to right. Read the [map-reduce in RethinkDB](http://rethinkdb.com/docs/map-reduce/) article to\nsee an example.\n\nIf the sequence is empty, the server will produce a `ReqlRuntimeError` that can be\ncaught with `default`.  \nIf the sequence has only one element, the first element will be returned.\n\n*Example* Return the number of documents in the table `posts`.\n\n    r.table("posts").map(lambda doc: 1)\n        .reduce(lambda left, right: left+right)\n        .default(0).run(conn)\n\nA shorter way to execute this query is to use [count](http://rethinkdb.com/api/python/count).\n\n*Example* Suppose that each `post` has a field `comments` that is an array of\ncomments.  \nReturn the number of comments for all posts.\n\n    r.table("posts").map(lambda doc:\n        doc["comments"].count()\n    ).reduce(lambda left, right:\n        left+right\n    ).default(0).run(conn)\n\n*Example* Suppose that each `post` has a field `comments` that is an array of\ncomments.  \nReturn the maximum number comments per post.\n\n    r.table("posts").map(lambda doc:\n        doc["comments"].count()\n    ).reduce(lambda left, right:\n        r.branch(\n            left > right,\n            left,\n            right\n        )\n    ).default(0).run(conn)\n\nA shorter way to execute this query is to use [max](http://rethinkdb.com/api/python/max).\n'),
	(rethinkdb.ast.RqlQuery.sum, b"sequence.sum([field | function]) -> number\n\nSums all the elements of a sequence.  If called with a field name,\nsums all the values of that field in the sequence, skipping elements\nof the sequence that lack that field.  If called with a function,\ncalls that function on every element of the sequence and sums the\nresults, skipping elements of the sequence where that function returns\n`None` or a non-existence error.\n\nReturns `0` when called on an empty sequence.\n\n*Example* What's 3 + 5 + 7?\n\n    r.expr([3, 5, 7]).sum().run(conn)\n\n*Example* How many points have been scored across all games?\n\n    r.table('games').sum('points').run(conn)\n\n*Example* How many points have been scored across all games,\ncounting bonus points?\n\n    r.table('games').sum(lambda game:\n        game['points'] + game['bonus_points']\n    ).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.ungroup, b'grouped_stream.ungroup() -> array\ngrouped_data.ungroup() -> array\n\nTakes a grouped stream or grouped data and turns it into an array of\nobjects representing the groups.  Any commands chained after `ungroup`\nwill operate on this array, rather than operating on each group\nindividually.  This is useful if you want to e.g. order the groups by\nthe value of their reduction.\n\nThe format of the array returned by `ungroup` is the same as the\ndefault native format of grouped data in the JavaScript driver and\ndata explorer.\n\nSuppose that the table `games` has the following data:\n\n    [\n        {"id": 2, "player": "Bob", "points": 15, "type": "ranked"},\n        {"id": 5, "player": "Alice", "points": 7, "type": "free"},\n        {"id": 11, "player": "Bob", "points": 10, "type": "free"},\n        {"id": 12, "player": "Alice", "points": 2, "type": "free"}\n    ]\n\n*Example* What is the maximum number of points scored by each\nplayer, with the highest scorers first?\n\n    r.table(\'games\')\n       .group(\'player\').max(\'points\')[\'points\']\n       .ungroup().order_by(r.desc(\'reduction\')).run(conn)\n\n<!-- stop -->\n\nResult: \n\n    [\n        {\n            "group": "Bob",\n            "reduction": 15\n        },\n        {\n            "group": "Alice",\n            "reduction": 7\n        }\n    ]\n\n*Example* Select one random player and all their games.\n\n    r.table(\'games\').group(\'player\').ungroup().sample(1).run(conn)\n\nResult:\n\n    [\n        {\n            "group": "Bob",\n            "reduction": [\n                {"id": 2, "player": "Bob", "points": 15, "type": "ranked"},\n                {"id": 11, "player": "Bob", "points": 10, "type": "free"}\n            ]\n        }\n    ]\n\nNote that if you didn\'t call `ungroup`, you would instead select one\nrandom game from each player:\n\n    r.table(\'games\').group(\'player\').sample(1).run(conn)\n\nResult:\n\n    {\n        "Alice": [\n            {"id": 5, "player": "Alice", "points": 7, "type": "free"}\n        ],\n        "Bob": [\n            {"id": 11, "player": "Bob", "points": 10, "type": "free"}\n        ]\n    }\n\n*Example* Types!\n\n    r.table(\'games\').group(\'player\').type_of().run(conn) # Returns "GROUPED_STREAM"\n    r.table(\'games\').group(\'player\').ungroup().type_of().run(conn) # Returns "ARRAY"\n    r.table(\'games\').group(\'player\').avg(\'points\').run(conn) # Returns "GROUPED_DATA"\n    r.table(\'games\').group(\'player\').avg(\'points\').ungroup().run(conn) #Returns "ARRAY"\n'),
	(rethinkdb.args, b"r.args(array) -> special\n\n`r.args` is a special term that's used to splice an array of arguments\ninto another term.  This is useful when you want to call a variadic\nterm such as [get_all](http://rethinkdb.com/api/python/get_all/) with a set of arguments produced at runtime.\n\nThis is analogous to unpacking argument lists in Python.\n\n*Example* Get Alice and Bob from the table `people`.\n\n    r.table('people').get_all('Alice', 'Bob').run(conn)\n    # or\n    r.table('people').get_all(r.args(['Alice', 'Bob'])).run(conn)\n\n*Example* Get all of Alice's children from the table `people`.\n\n    # r.table('people').get('Alice') returns {'id': 'Alice', 'children': ['Bob', 'Carol']}\n    r.table('people').get_all(r.args(r.table('people').get('Alice')['children'])).run(conn)\n"),
	(rethinkdb.binary, b'r.binary(data) -> binary\n\nEncapsulate binary data within a query.\n\nThe type of data `binary` accepts depends on the client language. In Python, it expects a parameter of `bytes` type. Using a `bytes` object within a query implies the use of `binary` and the ReQL driver will automatically perform the coercion (in Python 3 only).\n\nBinary objects returned to the client in JavaScript will also be of the `bytes` type. This can be changed with the `binary_format` option provided to [run](http://rethinkdb.com/api/python/run) to return "raw" objects.\n\nOnly a limited subset of ReQL commands may be chained after `binary`:\n\n* [coerce_to](http://rethinkdb.com/api/python/coerce_to/) can coerce `binary` objects to `string` types\n* [count](http://rethinkdb.com/api/python/count/) will return the number of bytes in the object\n* [slice](http://rethinkdb.com/api/python/slice/) will treat bytes like array indexes (i.e., `slice(10,20)` will return bytes 10&ndash;19)\n* [type_of](http://rethinkdb.com/api/python/type_of) returns `PTYPE<BINARY>`\n* [info](http://rethinkdb.com/api/python/info) will return information on a binary object.\n\n*Example* Save an avatar image to a existing user record.\n\n    f = open(\'./default_avatar.png\', \'rb\')\n    avatar_image = f.read()\n    f.close()\n    r.table(\'users\').get(100).update({\'avatar\': r.binary(avatar_image)}).run(conn)\n\n*Example* Get the size of an existing avatar image.\n\n    r.table(\'users\').get(100)[\'avatar\'].count().run(conn)\n    \n    14156\n\nRead more details about RethinkDB\'s binary object support: [Storing binary objects](http://rethinkdb.com/docs/storing-binary/).\n'),
	(rethinkdb.branch, b'r.branch(test, true_action[, test2, test2_action, ...], false_action) -> any\ntest.branch(true_action[, test2, test2_action, ...], false_action) -> any\n\nPerform a branching conditional equivalent to `if-then-else`.\n\nThe `branch` command takes 2n+1 arguments: pairs of conditional expressions and commands to be executed if the conditionals return any value but `False` or `None` (i.e., "truthy" values), with a final "else" command to be evaluated if all of the conditionals are `False` or `None`.\n\n<!-- break -->\n\nYou may call `branch` infix style on the first test. (See the second example for an illustration.)\n\nr.branch(test1, val1, test2, val2, elseval)\n\nis the equivalent of the Python statement\n\n    if test1:\n        return val1\n    elif test2:\n        return val2\n    else:\n        return elseval\n\n*Example* Test the value of x.\n\n    x = 10\n    r.branch((x > 5), \'big\', \'small\').run(conn)\n    \n    > "big"\n\n*Example* As above, infix-style.\n\n    x = 10\n    r.expr(x > 5).branch(\'big\', \'small\').run(conn)\n    \n    > "big"\n\n*Example* Categorize heroes by victory counts.\n\n    r.table(\'marvel\').map(\n        r.branch(\n            r.row[\'victories\'] > 100,\n            r.row[\'name\'] + \' is a superhero\',\n            r.row[\'victories\'] > 10,\n            r.row[\'name\'] + \' is a hero\',\n            r.row[\'name\'] + \' is very nice\'\n        )\n    ).run(conn)\n\nIf the documents in the table `marvel` are:\n\n    [\n        { "name": "Iron Man", "victories": 214 },\n        { "name": "Jubilee", "victories": 49 },\n        { "name": "Slava", "victories": 5 }\n    ]\n\nThe results will be:\n\n    [\n        "Iron Man is a superhero",\n        "Jubilee is a hero",\n        "Slava is very nice"\n    ]\n'),
	(rethinkdb.ast.RqlQuery.coerce_to, b"sequence.coerce_to('array') -> array\nvalue.coerce_to('string') -> string\nstring.coerce_to('number') -> number\narray.coerce_to('object') -> object\nsequence.coerce_to('object') -> object\nobject.coerce_to('array') -> array\nbinary.coerce_to('string') -> string\nstring.coerce_to('binary') -> binary\n\nConvert a value of one type into another.\n\n* a sequence, selection or object can be coerced to an array\n* a sequence, selection or an array of key-value pairs can be coerced to an object\n* a string can be coerced to a number\n* any datum (single value) can be coerced to a string\n* a binary object can be coerced to a string and vice-versa\n\n*Example* Coerce a stream to an array to store its output in a field. (A stream cannot be stored in a field directly.)\n\n    r.table('posts').map(lambda post: post.merge(\n        { 'comments': r.table('comments').get_all(post['id'], index='post_id').coerce_to('array') }\n    )).run(conn)\n\n*Example* Coerce an array of pairs into an object.\n\n    r.expr([['name', 'Ironman'], ['victories', 2000]]).coerce_to('object').run(conn)\n\n__Note:__ To coerce a list of key-value pairs like `['name', 'Ironman', 'victories', 2000]` to an object, use the [object](http://rethinkdb.com/api/python/object) command.\n\n*Example* Coerce a number to a string.\n\n    r.expr(1).coerce_to('string').run(conn)\n\n"),
	(rethinkdb.ast.RqlQuery.default, b'value.default(default_value | function) -> any\nsequence.default(default_value | function) -> any\n\nProvide a default value in case of non-existence errors. The `default` command evaluates its first argument (the value it\'s chained to). If that argument returns `None` or a non-existence error is thrown in evaluation, then `default` returns its second argument. The second argument is usually a default value, but it can be a function that returns a value.\n\n*Example* Retrieve the titles and authors of the table `posts`.\nIn the case where the author field is missing or `None`, we want to retrieve the string\n`Anonymous`.\n\n    r.table("posts").map(lambda post:\n        {\n            "title": post["title"],\n            "author": post["author"].default("Anonymous")\n        }\n    ).run(conn)\n\n<!-- stop -->\n\nWe can rewrite the previous query with `r.branch` too.\n\n    r.table("posts").map(lambda post:\n        r.branch(\n            post.has_fields("author"),\n            {\n                "title": post["title"],\n                "author": post["author"]\n            },\n            {\n                "title": post["title"],\n                "author": "Anonymous" \n            }\n        )\n    ).run(conn)\n\n*Example* The `default` command can also be used to filter documents. Retrieve all our users who are not grown-ups or whose age is unknown\n(i.e., the field `age` is missing or equals `None`).\n\n    r.table("users").filter(lambda user:\n        (user["age"] < 18).default(True)\n    ).run(conn)\n\nOne more way to write the previous query is to set the age to be `-1` when the\nfield is missing.\n\n    r.table("users").filter(lambda user:\n        user["age"].default(-1) < 18\n    ).run(conn)\n\nThis can be accomplished with [has_fields](http://rethinkdb.com/api/python/has_fields/) rather than `default`.\n\n    r.table("users").filter(lambda user:\n        user.has_fields("age").not_() | (user["age"] < 18)\n    ).run(conn)\n\nThe body of every [filter](http://rethinkdb.com/api/python/filter/) is wrapped in an implicit `.default(False)`. You can overwrite the value `False` with the `default` option.\n\n    r.table("users").filter(\n        lambda user: (user["age"] < 18).default(True),\n        default=True\n    ).run(conn)\n\n*Example* The function form of `default` receives the error message as its argument.\n\n    r.table("posts").map(lambda post:\n        {\n            "title": post["title"],\n            "author": post["author"].default(lambda err: err)\n        }\n    ).run(conn)\n\nThis particular example simply returns the error message, so it isn\'t very useful. But it would be possible to change the default value based on the specific error message thrown.\n'),
	(rethinkdb.ast.RqlQuery.do, b"any.do(function) -> any\nr.do([args]*, function) -> any\nany.do(expr) -> any\nr.do([args]*, expr) -> any\n\nCall an anonymous function using return values from other ReQL commands or queries as arguments.\n\nThe last argument to `do` (or, in some forms, the only argument) is an expression or an anonymous function which receives values from either the previous arguments or from prefixed commands chained before `do`. The `do` command is essentially a single-element [map](http://rethinkdb.com/api/python/map/), letting you map a function over just one document. This allows you to bind a query result to a local variable within the scope of `do`, letting you compute the result just once and reuse it in a complex expression or in a series of ReQL commands.\n\nArguments passed to the `do` function must be basic data types, and cannot be streams or selections. (Read about [ReQL data types](http://rethinkdb.com/docs/data-types/).) While the arguments will all be evaluated before the function is executed, they may be evaluated in any order, so their values should not be dependent on one another. The type of `do`'s result is the type of the value returned from the function or last expression.\n\n*Example* Compute a golfer's net score for a game.\n\n    r.table('players').get('86be93eb-a112-48f5-a829-15b2cb49de1d').do(\n        lambda player: player['gross_score'] - player['course_handicap']\n    ).run(conn)\n\n*Example* Return the name of the best scoring player in a two-player golf match.\n\n    r.do(r.table('players').get(id1), r.table('players').get(id2),\n        (lambda player1, player2:\n            r.branch(player1['gross_score'].lt(player2['gross_score']),\n            player1, player2))\n    ).run(conn)\n\nNote that `branch`, the ReQL conditional command, must be used instead of `if`. See the `branch` [documentation](http://rethinkdb.com/api/python/branch) for more.\n\n*Example* Take different actions based on the result of a ReQL [insert](http://rethinkdb.com/api/python/insert) command.\n\n    new_data = {\n        'id': 100,\n        'name': 'Agatha',\n        'gross_score': 57,\n        'course_handicap': 4\n    }\n    r.table('players').insert(new_data).do(lambda doc:\n        r.branch((doc['inserted'] != 0),\n            r.table('log').insert({'time': r.now(), 'response': doc, 'result': 'ok'}),\n            r.table('log').insert({'time': r.now(), 'response': doc, 'result': 'error'}))\n    ).run(conn)\n"),
	(rethinkdb.error, b"r.error(message) -> error\n\nThrow a runtime error. If called with no arguments inside the second argument to `default`, re-throw the current error.\n\n*Example* Iron Man can't possibly have lost a battle:\n\n    r.table('marvel').get('IronMan').do(\n        lambda ironman: r.branch(ironman['victories'] < ironman['battles'],\n                                 r.error('impossible code path'),\n                                 ironman)\n    ).run(conn)\n\n"),
	(rethinkdb.expr, b"r.expr(value) -> value\n\nConstruct a ReQL JSON object from a native object.\n\nIf the native object is of the `bytes` type, then `expr` will return a binary object. See [binary](http://rethinkdb.com/api/python/binary) for more information.\n\n*Example* Objects wrapped with `expr` can then be manipulated by ReQL API functions.\n\n    r.expr({'a':'b'}).merge({'b':[1,2,3]}).run(conn)\n\n"),
	(rethinkdb.ast.RqlQuery.for_each, b"sequence.for_each(write_function) -> object\n\nLoop over a sequence, evaluating the given write query for each element.\n\n*Example* Now that our heroes have defeated their villains, we can safely remove them from the villain table.\n\n    r.table('marvel').for_each(\n        lambda hero: r.table('villains').get(hero['villainDefeated']).delete()\n    ).run(conn)\n\n"),
	(rethinkdb.http, b'r.http(url[, options]) -> value\nr.http(url[, options]) -> stream\n\nRetrieve data from the specified URL over HTTP.  The return type depends on the `result_format` option, which checks the `Content-Type` of the response by default.\n\n*Example* Perform an HTTP `GET` and store the result in a table.\n\n    r.table(\'posts\').insert(r.http(\'http://httpbin.org/get\')).run(conn)\n\n<!-- stop -->\n\nSee [the tutorial](http://rethinkdb.com/docs/external-api-access/) on `r.http` for more examples on how to use this command.\n\n* `timeout`: timeout period in seconds to wait before aborting the connect (default `30`).\n* `attempts`: number of retry attempts to make after failed connections (default `5`).\n* `redirects`: number of redirect and location headers to follow (default `1`).\n* `verify`: if `true`, verify the server\'s SSL certificate (default `true`).\n* `result_format`: string specifying the format to return results in. One of the following:\n    * `text`: always return a string.\n    * `json`: parse the result as JSON, raising an error on failure.\n    * `jsonp`: parse the result as Padded JSON.\n    * `binary`: return a binary object.\n    * `auto`: parse the result based on its `Content-Type` (the default):\n        * `application/json`: as `json`\n        * `application/json-p`, `text/json-p`, `text/javascript`: as `jsonp`\n        * `audio/*`, `video/*`, `image/*`, `application/octet-stream`: as `binary`\n        * anything else: as `text`\n\n* `method`: HTTP method to use for the request. One of `GET`, `POST`, `PUT`, `PATCH`, `DELETE` or `HEAD`. Default: `GET`.\n* `auth`: object giving authentication, with the following fields:\n    * `type`: `basic` (default) or `digest`\n    * `user`: username\n    * `pass`: password in plain text\n* `params`: object specifying URL parameters to append to the URL as encoded key/value pairs. `{ \'query\': \'banana\', \'limit\': 2 }` will be appended as `?query=banana&limit=2`. Default: no parameters.\n* `header`: Extra header lines to include. The value may be an array of strings or an object. Default: `Accept-Encoding: deflate;q=1, gzip;q=0.5` and `User-Agent: RethinkDB/<VERSION>`.\n* `data`: Data to send to the server on a `POST`, `PUT`, `PATCH`, or `DELETE` request. For `POST` requests, data may be either an object (which will be written to the body as form-encoded key/value pairs) or a string; for all other requests, data will be serialized as JSON and placed in the request body, sent as `Content-Type: application/json`. Default: no data will be sent.\n\n*Example* Perform multiple requests with different parameters.\n\n    r.expr([1, 2, 3]).map(\n        lambda i: r.http(\'http://httpbin.org/get\', params={\'user\': i})\n    ).run(conn)\n\n*Example* Perform a `PUT` request for each item in a table.\n\n    r.table(\'data\').map(\n        lambda row: r.http(\'http://httpbin.org/put\', method=\'PUT\', data=row)\n    ).run(conn)\n\n*Example* Perform a `POST` request with accompanying data.\n\nUsing form-encoded data:\n\n    r.http(\'http://httpbin.org/post\', method=\'POST\',\n        data={\'player\': \'Bob\', \'game\': \'tic tac toe\'}\n    ).run(conn)\n\nUsing JSON data:\n\n    r.http(\'http://httpbin.org/post\', method=\'POST\',\n        data=r.expr(value).coerce_to(\'string\'),\n        header={\'Content-Type\': \'application/json\'}\n    ).run(conn)\n\n`r.http` supports depagination, which will request multiple pages in a row and aggregate the results into a stream.  The use of this feature is controlled by the optional arguments `page` and `page_limit`.  Either none or both of these arguments must be provided.\n\n* `page`: This option may specify either a built-in pagination strategy (see below), or a function to provide the next URL and/or `params` to request.\n* `page_limit`: An integer specifying the maximum number of requests to issue using the `page` functionality.  This is to prevent overuse of API quotas, and must be specified with `page`.\n    * `-1`: no limit\n    * `0`: no requests will be made, an empty stream will be returned\n    * `n`: `n` requests will be made\n\nAt the moment, the only built-in strategy is `\'link-next\'`, which is equivalent to `lambda info: info\'header\'[\'rel="next"\'].default(None)`.\n\n*Example* Perform a GitHub search and collect up to 3 pages of results.\n\n    r.http("https://api.github.com/search/code?q=addClass+user:mozilla",\n        page=\'link-next\', page_limit=3).run(conn)\n\nAs a function, `page` takes one parameter, an object of the format:\n\n    {\n        \'params\': object, # the URL parameters used in the last request\n        \'header\': object, # the HTTP headers of the last response as key/value pairs\n        \'body\': value # the body of the last response in the format specified by `result_format`\n    }\n\nThe `header` field will be a parsed version of the header with fields lowercased, like so:\n\n    {\n        \'content-length\': \'1024\',\n        \'content-type\': \'application/json\',\n        \'date\': \'Thu, 1 Jan 1970 00:00:00 GMT\',\n        \'link\': {\n            \'rel="last"\': \'http://example.com/?page=34\',\n            \'rel="next"\': \'http://example.com/?page=2\'\n        }\n    }\n\nThe `page` function may return a string corresponding to the next URL to request, `None` indicating that there is no more to get, or an object of the format:\n\n    {\n        \'url\': string, # the next URL to request, or None for no more pages\n        \'params\': object # new URL parameters to use, will be merged with the previous request\'s params\n    }\n\n*Example* Perform depagination with a custom `page` function.\n\n    r.http(\'example.com/pages\',\n        page=(lambda info: info[\'body\'][\'meta\'][\'next\'].default(None)),\n        page_limit=5\n    ).run(conn)\n\n# Learn more\n\nSee [the tutorial](http://rethinkdb.com/docs/external-api-access/) on `r.http` for more examples on how to use this command.\n'),
	(rethinkdb.ast.RqlQuery.info, b"any.info() -> object\nr.info(any) -> object\n\nGet information about a ReQL value.\n\n*Example* Get information about a table such as primary key, or cache size.\n\n    r.table('marvel').info().run(conn)\n\n"),
	(rethinkdb.js, b'r.js(js_string[, timeout=<number>]) -> value\n\nCreate a javascript expression.\n\n*Example* Concatenate two strings using JavaScript.\n\n`timeout` is the number of seconds before `r.js` times out. The default value is 5 seconds.\n\n    r.js("\'str1\' + \'str2\'").run(conn)\n\n*Example* Select all documents where the \'magazines\' field is greater than 5 by running JavaScript on the server.\n\n    r.table(\'marvel\').filter(\n        r.js(\'(function (row) { return row.magazines.length > 5; })\')\n    ).run(conn)\n\n*Example* You may also specify a timeout in seconds (defaults to 5).\n\n    r.js(\'while(true) {}\', timeout=1.3).run(conn)\n\n'),
	(rethinkdb.json, b'r.json(json_string) -> value\n\nParse a JSON string on the server.\n\n*Example* Send an array to the server.\n\n    r.json("[1,2,3]").run(conn)\n\n'),
	(rethinkdb.range, b'r.range() -> stream\nr.range([start_value, ]end_value) -> stream\n\nGenerate a stream of sequential integers in a specified range.\n\n`range` takes 0, 1 or 2 arguments:\n\n* With no arguments, `range` returns an "infinite" stream from 0 up to and including the maximum integer value;\n* With one argument, `range` returns a stream from 0 up to but not including the end value;\n* With two arguments, `range` returns a stream from the start value up to but not including the end value.\n\nNote that the left bound (including the implied left bound of 0 in the 0- and 1-argument form) is always closed and the right bound is always open: the start value will always be included in the returned range and the end value will *not* be included in the returned range.\n\nAny specified arguments must be integers, or a `ReqlRuntimeError` will be thrown. If the start value is equal or to higher than the end value, no error will be thrown but a zero-element stream will be returned.\n\n*Example* Return a four-element range of `[0, 1, 2, 3]`.\n\n    > r.range(4).run(conn)\n    \n    [0, 1, 2, 3]\n\n<!-- stop -->\n\nYou can also use the [limit](http://rethinkdb.com/api/python/limit) command with the no-argument variant to achieve the same result in this case:\n\n    > r.range().limit(4).run(conn)\n    \n    [0, 1, 2, 3]\n\n*Example* Return a range from -5 through 5.\n\n    > r.range(-5, 6).run(conn)\n    \n    [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5]\n'),
	(rethinkdb.ast.RqlQuery.to_json_string, b'value.to_json_string() -> string\nvalue.to_json() -> string\n\nConvert a ReQL value or object to a JSON string. You may use either `to_json_string` or `to_json`.\n\n*Example* Get a ReQL document as a JSON string.\n\n    > r.table(\'hero\').get(1).to_json()\n    \n    \'{"id": 1, "name": "Batman", "city": "Gotham", "powers": ["martial arts", "cinematic entrances"]}\'\n'),
	(rethinkdb.ast.RqlQuery.to_json, b'value.to_json_string() -> string\nvalue.to_json() -> string\n\nConvert a ReQL value or object to a JSON string. You may use either `to_json_string` or `to_json`.\n\n*Example* Get a ReQL document as a JSON string.\n\n    > r.table(\'hero\').get(1).to_json()\n    \n    \'{"id": 1, "name": "Batman", "city": "Gotham", "powers": ["martial arts", "cinematic entrances"]}\'\n'),
	(rethinkdb.ast.RqlQuery.type_of, b'any.type_of() -> string\n\nGets the type of a ReQL query\'s return value.\n\nThe type will be returned as a string:\n\n* `ARRAY`\n* `BOOL`\n* `DB`\n* `FUNCTION`\n* `GROUPED_DATA`\n* `GROUPED_STREAM`\n* `MAXVAL`\n* `MINVAL`\n* `NULL`\n* `NUMBER`\n* `OBJECT`\n* `PTYPE<BINARY>`\n* `PTYPE<GEOMETRY>`\n* `PTYPE<TIME>`\n* `SELECTION<ARRAY>`\n* `SELECTION<OBJECT>`\n* `SELECTION<STREAM>`\n* `STREAM`\n* `STRING`\n* `TABLE_SLICE`\n* `TABLE`\n\nRead the article on [ReQL data types](docs/data-types/) for a more detailed discussion. Note that some possible return values from `type_of` are internal values, such as `MAXVAL`, and unlikely to be returned from queries in standard practice.\n\n*Example* Get the type of a string.\n\n    > r.expr("foo").type_of().run(conn)\n    "STRING"\n\n'),
	(rethinkdb.uuid, b'r.uuid([string]) -> string\n\nReturn a UUID (universally unique identifier), a string that can be used as a unique ID. If a string is passed to `uuid` as an argument, the UUID will be deterministic, derived from the string\'s SHA-1 hash.\n\nRethinkDB\'s UUIDs are standards-compliant. Without the optional argument, a version 4 random UUID will be generated; with that argument, a version 5 UUID will be generated, using a fixed namespace UUID of `91461c99-f89d-49d2-af96-d8e2e14e9b58`. For more information, read Wikipedia\'s UUID article.\n\n*Example* Generate a UUID.\n\n    > r.uuid().run(conn)\n    \n    "27961a0e-f4e8-4eb3-bf95-c5203e1d87b9"\n\n*Example* Generate a UUID based on a string.\n\n    > r.uuid("slava@example.com").run(conn)\n    \n    "90691cbc-b5ea-5826-ae98-951e30fc3b2d"\n'),
	(rethinkdb.net.Cursor.close, b'cursor.close()\n\nClose a cursor. Closing a cursor cancels the corresponding query and frees the memory\nassociated with the open request.\n\n*Example* Close a cursor.\n\n    cursor.close()\n'),
	(rethinkdb.net.Cursor.next, b"cursor.next([wait=True])\n\nGet the next element in the cursor.\n\nThe optional `wait` argument specifies whether to wait for the next available element and how long to wait:\n\n* `True`: Wait indefinitely (the default).\n* `False`: Do not wait at all. If data is immediately available, it will be returned; if it is not available, a `ReqlTimeoutError` will be raised.\n* number: Wait up to the specified number of seconds for data to be available before raising `ReqlTimeoutError`.\n\nThe behavior of `next` will be identical with `False`, `None` or the number `0`.\n\nCalling `next` the first time on a cursor provides the first element of the cursor. If the data set is exhausted (e.g., you have retrieved all the documents in a table), a `ReqlCursorEmpty` error will be raised when `next` is called.\n\n*Example* Retrieve the next element.\n\n    cursor = r.table('superheroes').run(conn)\n    doc = cursor.next()\n\n*Example* Retrieve the next element on a [changefeed](http://rethinkdb.com/docs/changefeeds/python), waiting up to five seconds.\n\n    cursor = r.table('superheroes').changes().run(conn)\n    doc = cursor.next(wait=5)\n\n__Note:__ RethinkDB sequences can be iterated through via the Python Iterable interface. The canonical way to retrieve all the results is to use a [for...in](../each/) loop or [list()](../to_array/).\n\n"),
	(rethinkdb.ast.RqlQuery.date, b'time.date() -> time\n\nReturn a new time object only based on the day, month and year (ie. the same day at 00:00).\n\n*Example* Retrieve all the users whose birthday is today.\n\n    r.table("users").filter(lambda user:\n        user["birthdate"].date() == r.now().date()\n    ).run(conn)\n\n'),
	(rethinkdb.ast.RqlQuery.day, b'time.day() -> number\n\nReturn the day of a time object as a number between 1 and 31.\n\n*Example* Return the users born on the 24th of any month.\n\n    r.table("users").filter(\n        r.row["birthdate"].day() == 24\n    )\n\n'),
	(rethinkdb.ast.RqlQuery.day_of_week, b'time.day_of_week() -> number\n\nReturn the day of week of a time object as a number between 1 and 7 (following ISO 8601 standard). For your convenience, the terms r.monday, r.tuesday etc. are defined and map to the appropriate integer.\n\n*Example* Return today\'s day of week.\n\n    r.now().day_of_week().run(conn)\n\n*Example* Retrieve all the users who were born on a Tuesday.\n\n    r.table("users").filter( lambda user:\n        user["birthdate"].day_of_week().eq(r.tuesday)\n    )\n\n'),
	(rethinkdb.ast.RqlQuery.day_of_year, b'time.day_of_year() -> number\n\nReturn the day of the year of a time object as a number between 1 and 366 (following ISO 8601 standard).\n\n*Example* Retrieve all the users who were born the first day of a year.\n\n    r.table("users").filter(\n        r.row["birthdate"].day_of_year() == 1\n    ).run(conn)\n\n'),
	(rethinkdb.ast.RqlQuery.during, b'time.during(start_time, end_time[, left_bound="closed", right_bound="open"])\n    -> bool\n\nReturn whether a time is between two other times.\n\nBy default, this is inclusive of the start time and exclusive of the end time. Set `left_bound` and `right_bound` to explicitly include (`closed`) or exclude (`open`) that endpoint of the range.\n\n*Example* Retrieve all the posts that were posted between December 1st, 2013 (inclusive) and December 10th, 2013 (exclusive).\n\n    r.table("posts").filter(\n        r.row[\'date\'].during(r.time(2013, 12, 1, "Z"), r.time(2013, 12, 10, "Z"))\n    ).run(conn)\n\n*Example* Retrieve all the posts that were posted between December 1st, 2013 (exclusive) and December 10th, 2013 (inclusive).\n\n    r.table("posts").filter(\n        r.row[\'date\'].during(r.time(2013, 12, 1, "Z"), r.time(2013, 12, 10, "Z"), left_bound="open", right_bound="closed")\n    ).run(conn)\n\n'),
	(rethinkdb.epoch_time, b'r.epoch_time(number) -> time\n\nCreate a time object based on seconds since epoch. The first argument is a double and\nwill be rounded to three decimal places (millisecond-precision).\n\n*Example* Update the birthdate of the user "John" to November 3rd, 1986.\n\n    r.table("user").get("John").update({"birthdate": r.epoch_time(531360000)}).run(conn)\n\n'),
	(rethinkdb.ast.RqlQuery.hours, b'time.hours() -> number\n\nReturn the hour in a time object as a number between 0 and 23.\n\n*Example* Return all the posts submitted after midnight and before 4am.\n\n    r.table("posts").filter(lambda post:\n        post["date"].hours() < 4\n    ).run(conn)\n\n'),
	(rethinkdb.ast.RqlQuery.in_timezone, b"time.in_timezone(timezone) -> time\n\nReturn a new time object with a different timezone. While the time stays the same, the results returned by methods such as hours() will change since they take the timezone into account. The timezone argument has to be of the ISO 8601 format.\n\n*Example* Hour of the day in San Francisco (UTC/GMT -8, without daylight saving time).\n\n    r.now().in_timezone('-08:00').hours().run(conn)\n"),
	(rethinkdb.iso8601, b'r.iso8601(string[, default_timezone=\'\']) -> time\n\nCreate a time object based on an ISO 8601 date-time string (e.g. \'2013-01-01T01:01:01+00:00\'). RethinkDB supports all valid ISO 8601 formats except for week dates. Read more about the ISO 8601 format at [Wikipedia](http://en.wikipedia.org/wiki/ISO_8601).\n\nIf you pass an ISO 8601 string without a time zone, you must specify the time zone with the `default_timezone` argument.\n\n*Example* Update the time of John\'s birth.\n\n    r.table("user").get("John").update({"birth": r.iso8601(\'1986-11-03T08:30:00-07:00\')}).run(conn)\n'),
	(rethinkdb.ast.RqlQuery.minutes, b'time.minutes() -> number\n\nReturn the minute in a time object as a number between 0 and 59.\n\n*Example* Return all the posts submitted during the first 10 minutes of every hour.\n\n    r.table("posts").filter(lambda post:\n        post["date"].minutes() < 10\n    ).run(conn)\n'),
	(rethinkdb.ast.RqlQuery.month, b'time.month() -> number\n\nReturn the month of a time object as a number between 1 and 12. For your convenience, the terms r.january, r.february etc. are defined and map to the appropriate integer.\n\n*Example* Retrieve all the users who were born in November.\n\n    r.table("users").filter(\n        r.row["birthdate"].month() == 11\n    )\n\n*Example* Retrieve all the users who were born in November.\n\n    r.table("users").filter(\n        r.row["birthdate"].month() == r.november\n    )\n\n'),
	(rethinkdb.now, b'r.now() -> time\n\nReturn a time object representing the current time in UTC. The command now() is computed once when the server receives the query, so multiple instances of r.now() will always return the same time inside a query.\n\n*Example* Add a new user with the time at which he subscribed.\n\n    r.table("users").insert({\n        "name": "John",\n        "subscription_date": r.now()\n    }).run(conn)\n\n'),
	(rethinkdb.ast.RqlQuery.seconds, b'time.seconds() -> number\n\nReturn the seconds in a time object as a number between 0 and 59.999 (double precision).\n\n*Example* Return the post submitted during the first 30 seconds of every minute.\n\n    r.table("posts").filter(lambda post:\n        post["date"].seconds() < 30\n    ).run(conn)\n\n'),
	(rethinkdb.time, b'r.time(year, month, day[, hour, minute, second], timezone)\n    -> time\n\nCreate a time object for a specific time.\n\nA few restrictions exist on the arguments:\n\n- `year` is an integer between 1400 and 9,999.\n- `month` is an integer between 1 and 12.\n- `day` is an integer between 1 and 31.\n- `hour` is an integer.\n- `minutes` is an integer.\n- `seconds` is a double. Its value will be rounded to three decimal places\n(millisecond-precision).\n- `timezone` can be `\'Z\'` (for UTC) or a string with the format `\xc2\xb1[hh]:[mm]`.\n\n*Example* Update the birthdate of the user "John" to November 3rd, 1986 UTC.\n\n    r.table("user").get("John").update({"birthdate": r.time(1986, 11, 3, \'Z\')}).run(conn)\n\n'),
	(rethinkdb.ast.RqlQuery.time_of_day, b'time.time_of_day() -> number\n\nReturn the number of seconds elapsed since the beginning of the day stored in the time object.\n\n*Example* Retrieve posts that were submitted before noon.\n\n    r.table("posts").filter(\n        r.row["date"].time_of_day() <= 12*60*60\n    ).run(conn)\n\n'),
	(rethinkdb.ast.RqlQuery.timezone, b'time.timezone() -> string\n\nReturn the timezone of the time object.\n\n*Example* Return all the users in the "-07:00" timezone.\n\n    r.table("users").filter(lambda user:\n        user["subscriptionDate"].timezone() == "-07:00"\n    )\n\n'),
	(rethinkdb.ast.RqlQuery.to_epoch_time, b'time.to_epoch_time() -> number\n\nConvert a time object to its epoch time.\n\n*Example* Return the current time in seconds since the Unix Epoch with millisecond-precision.\n\n    r.now().to_epoch_time()\n\n'),
	(rethinkdb.ast.RqlQuery.to_iso8601, b'time.to_iso8601() -> string\n\nConvert a time object to a string in ISO 8601 format.\n\n*Example* Return the current ISO 8601 time.\n\n    > r.now().to_iso8601().run(conn)\n    \n    "2015-04-20T18:37:52.690+00:00"\n\n'),
	(rethinkdb.ast.RqlQuery.year, b'time.year() -> number\n\nReturn the year of a time object.\n\n*Example* Retrieve all the users born in 1986.\n\n    r.table("users").filter(lambda user:\n        user["birthdate"].year() == 1986\n    ).run(conn)\n\n'),
	(rethinkdb.ast.RqlQuery.append, b"array.append(value) -> array\n\nAppend a value to an array.\n\n*Example* Retrieve Iron Man's equipment list with the addition of some new boots.\n\n    r.table('marvel').get('IronMan')['equipment'].append('newBoots').run(conn)\n\n"),
	(rethinkdb.ast.RqlQuery.__getitem__, b"sequence[attr] -> sequence\nsingleSelection[attr] -> value\nobject[attr] -> value\narray[index] -> value\n\nGet a single field from an object. If called on a sequence, gets that field from every object in the sequence, skipping objects that lack it.\n\n*Example* What was Iron Man's first appearance in a comic?\n\n    r.table('marvel').get('IronMan')['firstAppearance'].run(conn)\n\n<!-- stop -->\n\nThe `[]` command also accepts integer arguments as array offsets, like the [nth](http://rethinkdb.com/api/python/nth) command.\n\n*Example* Get the fourth element in a sequence. (The first element is position `0`, so the fourth element is position `3`.)\n\n    r.expr([10, 20, 30, 40, 50])[3]\n    \n    40\n"),
	(rethinkdb.ast.RqlQuery.change_at, b'array.change_at(index, value) -> array\n\nChange a value in an array at a given index. Returns the modified array.\n\n*Example* Bruce Banner hulks out.\n\n    r.expr(["Iron Man", "Bruce", "Spider-Man"]).change_at(1, "Hulk").run(conn)\n'),
	(rethinkdb.ast.RqlQuery.delete_at, b"array.delete_at(index [,endIndex]) -> array\n\nRemove one or more elements from an array at a given index. Returns the modified array. (Note: `delete_at` operates on arrays, not documents; to delete documents, see the [delete](http://rethinkdb.com/api/python/delete) command.)\n\nIf only `index` is specified, `delete_at` removes the element at that index. If both `index` and `end_index` are specified, `delete_at` removes the range of elements between `index` and `end_index`, inclusive of `index` but not inclusive of `end_index`.\n\nIf `end_index` is specified, it must not be less than `index`. Both `index` and `end_index` must be within the array's bounds (i.e., if the array has 10 elements, an `index` or `end_index` of 10 or higher is invalid).\n\nBy using a negative `index` you can delete from the end of the array. `-1` is the last element in the array, `-2` is the second-to-last element, and so on. You may specify a negative `end_index`, although just as with a positive value, this will not be inclusive. The range `(2,-1)` specifies the third element through the next-to-last element.\n\n*Example* Delete the second element of an array.\n\n    > r.expr(['a','b','c','d','e','f']).delete_at(1).run(conn)\n    \n    ['a', 'c', 'd', 'e', 'f']\n\n*Example* Delete the second and third elements of an array.\n\n    > r.expr(['a','b','c','d','e','f']).delete_at(1,3).run(conn)\n    \n    ['a', 'd', 'e', 'f']\n\n*Example* Delete the next-to-last element of an array.\n\n    > r.expr(['a','b','c','d','e','f']).delete_at(-2).run(conn)\n    \n    ['a', 'b', 'c', 'd', 'f']\n\n*Example* Delete a comment on a post.\n\nGiven a post document such as:\n\n{\n    id: '4cf47834-b6f9-438f-9dec-74087e84eb63',\n    title: 'Post title',\n    author: 'Bob',\n    comments: [\n        { author: 'Agatha', text: 'Comment 1' },\n        { author: 'Fred', text: 'Comment 2' }\n    ]\n}\n\nThe second comment can be deleted by using `update` and `delete_at` together.\n\n    r.table('posts').get('4cf47834-b6f9-438f-9dec-74087e84eb63').update(\n        lambda post: { 'comments': post['comments'].delete_at(1) }\n    ).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.difference, b"array.difference(array) -> array\n\nRemove the elements of one array from another array.\n\n*Example* Retrieve Iron Man's equipment list without boots.\n\n    r.table('marvel').get('IronMan')['equipment'].difference(['Boots']).run(conn)\n\n*Example* Remove Iron Man's boots from his equipment.\n\n    r.table('marvel').get('IronMan')['equipment'].update(lambda doc:\n        {'equipment': doc['equipment'].difference(['Boots'])}\n    ).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.get_field, b"sequence.get_field(attr) -> sequence\nsingleSelection.get_field(attr) -> value\nobject.get_field(attr) -> value\n\nGet a single field from an object. If called on a sequence, gets that field from every\nobject in the sequence, skipping objects that lack it.\n\n*Example* What was Iron Man's first appearance in a comic?\n\n    r.table('marvel').get('IronMan').get_field('firstAppearance').run(conn)\n"),
	(rethinkdb.ast.RqlQuery.has_fields, b'sequence.has_fields([selector1, selector2...]) -> stream\narray.has_fields([selector1, selector2...]) -> array\nobject.has_fields([selector1, selector2...]) -> boolean\n\nTest if an object has one or more fields. An object has a field if it has that key and the key has a non-null value. For instance, the object `{\'a\': 1,\'b\': 2,\'c\': null}` has the fields `a` and `b`.\n\nWhen applied to a single object, `has_fields` returns `true` if the object has the fields and `false` if it does not. When applied to a sequence, it will return a new sequence (an array or stream) containing the elements that have the specified fields.\n\n*Example* Return the players who have won games.\n\n    r.table(\'players\').has_fields(\'games_won\').run(conn)\n\n*Example* Return the players who have *not* won games. To do this, use `has_fields` with [not](http://rethinkdb.com/api/python/not), wrapped with [filter](http://rethinkdb.com/api/python/filter).\n\n    r.table(\'players\').filter(~r.row.has_fields(\'games_won\')).run(conn)\n\n*Example* Test if a specific player has won any games.\n\n    r.table(\'players\').get(\n        \'b5ec9714-837e-400c-aa74-dbd35c9a7c4c\').has_fields(\'games_won\').run(conn)\n\n**Nested Fields**\n\n`has_fields` lets you test for nested fields in objects. If the value of a field is itself a set of key/value pairs, you can test for the presence of specific keys.\n\n*Example* In the `players` table, the `games_won` field contains one or more fields for kinds of games won:\n\n    {\n        \'games_won\': {\n            \'playoffs\': 2,\n            \'championships\': 1\n        }\n    }\n\nReturn players who have the "championships" field.\n\n    r.table(\'players\').has_fields({\'games_won\': {\'championships\': True}}).run(conn)\n\nNote that `True` in the example above is testing for the existence of `championships` as a field, not testing to see if the value of the `championships` field is set to `true`. There\'s a more convenient shorthand form available. (See [pluck](http://rethinkdb.com/api/python/pluck) for more details on this.)\n\n    r.table(\'players\').has_fields({\'games_won\': \'championships\'}).run(conn)\n'),
	(rethinkdb.ast.RqlQuery.insert_at, b'array.insert_at(index, value) -> array\n\nInsert a value in to an array at a given index. Returns the modified array.\n\n*Example* Hulk decides to join the avengers.\n\n    r.expr(["Iron Man", "Spider-Man"]).insert_at(1, "Hulk").run(conn)\n\n'),
	(rethinkdb.ast.RqlQuery.keys, b'singleSelection.keys() -> array\nobject.keys() -> array\n\nReturn an array containing all of an object\'s keys. Note that the keys will be sorted as described in [ReQL data types](http://rethinkdb.com/docs/data-types/#sorting-order) (for strings, lexicographically).\n\n*Example* Get all the keys from a table row.\n\n    # row: { "id": 1, "mail": "fred@example.com", "name": "fred"  }\n    \n    r.table(\'users\').get(1).keys().run(conn)\n    \n    > [ "id", "mail", "name" ]\n'),
	(rethinkdb.literal, b'r.literal(object) -> special\n\nReplace an object in a field instead of merging it with an existing object in a `merge` or `update` operation. = Using `literal` with no arguments in a `merge` or `update` operation will remove the corresponding field.\n\nAssume your users table has this structure:\n\n    [\n        {\n            "id": 1,\n            "name": "Alice",\n            "data": {\n                "age": 18,\n                "city": "Dallas"\n            }\n        }       \n        ...\n    ]\n\nUsing `update` to modify the `data` field will normally merge the nested documents:\n\n    r.table(\'users\').get(1).update({ \'data\': { \'age\': 19, \'job\': \'Engineer\' } }).run(conn)\n    \n    {\n        "id": 1,\n        "name": "Alice",\n        "data": {\n            "age": 19,\n            "city": "Dallas",\n            "job": "Engineer"\n        }\n    }       \n\nThat will preserve `city` and other existing fields. But to replace the entire `data` document with a new object, use `literal`.\n\n*Example* Replace one nested document with another rather than merging the fields.\n\n    r.table(\'users\').get(1).update({ \'data\': r.literal({ \'age\': 19, \'job\': \'Engineer\' }) }).run(conn)\n    \n    {\n        "id": 1,\n        "name": "Alice",\n        "data": {\n            "age": 19,\n            "job": "Engineer"\n        }\n    }       \n\n*Example* Use `literal` to remove a field from a document.\n\n    r.table(\'users\').get(1).merge({ "data": r.literal() }).run(conn)\n    \n    {\n        "id": 1,\n        "name": "Alice"\n    }\n'),
	(rethinkdb.ast.RqlQuery.merge, b'singleSelection.merge([object | function, object | function, ...]) -> object\nobject.merge([object | function, object | function, ...]) -> object\nsequence.merge([object | function, object | function, ...]) -> stream\narray.merge([object | function, object | function, ...]) -> array\n\nMerge two or more objects together to construct a new object with properties from all. When there is a conflict between field names, preference is given to fields in the rightmost object in the argument list `merge` also accepts a subquery function that returns an object, which will be used similarly to a [map](http://rethinkdb.com/api/python/map/) function.\n\n*Example* Equip Thor for battle.\n\n    r.table(\'marvel\').get(\'thor\').merge(\n        r.table(\'equipment\').get(\'hammer\'),\n        r.table(\'equipment\').get(\'pimento_sandwich\')\n    ).run(conn)\n\n*Example* Equip every hero for battle, using a subquery function to retrieve their weapons.\n\n    r.table(\'marvel\').merge(lambda hero:\n        { \'weapons\': r.table(\'weapons\').get(hero[\'weapon_id\']) }\n    ).run(conn)\n\n*Example* Use `merge` to join each blog post with its comments.\n\nNote that the sequence being merged&mdash;in this example, the comments&mdash;must be coerced from a selection to an array. Without `coerce_to` the operation will throw an error ("Expected type DATUM but found SELECTION").\n\n    r.table(\'posts\').merge(lambda post:\n        { \'comments\': r.table(\'comments\').get_all(post[\'id\'],\n            index=\'post_id\').coerce_to(\'array\') }\n    ).run(conn)\n\n*Example* Merge can be used recursively to modify object within objects.\n\n    r.expr({\'weapons\' : {\'spectacular graviton beam\' : {\'dmg\' : 10, \'cooldown\' : 20}}}).merge(\n        {\'weapons\' : {\'spectacular graviton beam\' : {\'dmg\' : 10}}}\n    ).run(conn)\n\n*Example* To replace a nested object with another object you can use the literal keyword.\n\n    r.expr({\'weapons\' : {\'spectacular graviton beam\' : {\'dmg\' : 10, \'cooldown\' : 20}}}).merge(\n        {\'weapons\' : r.literal({\'repulsor rays\' : {\'dmg\' : 3, \'cooldown\' : 0}})}\n    ).run(conn)\n\n*Example* Literal can be used to remove keys from an object as well.\n\n    r.expr({\'weapons\' : {\'spectacular graviton beam\' : {\'dmg\' : 10, \'cooldown\' : 20}}}).merge(\n        {\'weapons\' : {\'spectacular graviton beam\' : r.literal()}}\n    ).run(conn)\n\n'),
	(rethinkdb.object, b'r.object([key, value,]...) -> object\n\nCreates an object from a list of key-value pairs, where the keys must\nbe strings.  `r.object(A, B, C, D)` is equivalent to\n`r.expr([[A, B], [C, D]]).coerce_to(\'OBJECT\')`.\n\n*Example* Create a simple object.\n\n    > r.object(\'id\', 5, \'data\', [\'foo\', \'bar\']).run(conn)\n    {\'data\': ["foo", "bar"], \'id\': 5}\n'),
	(rethinkdb.ast.RqlQuery.pluck, b"sequence.pluck([selector1, selector2...]) -> stream\narray.pluck([selector1, selector2...]) -> array\nobject.pluck([selector1, selector2...]) -> object\nsingleSelection.pluck([selector1, selector2...]) -> object\n\nPlucks out one or more attributes from either an object or a sequence of objects\n(projection).\n\n*Example* We just need information about IronMan's reactor and not the rest of the\ndocument.\n\n    r.table('marvel').get('IronMan').pluck('reactorState', 'reactorPower').run(conn)\n\n*Example* For the hero beauty contest we only care about certain qualities.\n\n    r.table('marvel').pluck('beauty', 'muscleTone', 'charm').run(conn)\n\n*Example* Pluck can also be used on nested objects.\n\n    r.table('marvel').pluck({'abilities' : {'damage' : True, 'mana_cost' : True}, 'weapons' : True}).run(conn)\n\n*Example* The nested syntax can quickly become overly verbose so there's a shorthand\nfor it.\n\n    r.table('marvel').pluck({'abilities' : ['damage', 'mana_cost']}, 'weapons').run(conn)\n\nFor more information read the [nested field documentation](http://rethinkdb.com/docs/nested-fields/).\n"),
	(rethinkdb.ast.RqlQuery.prepend, b"array.prepend(value) -> array\n\nPrepend a value to an array.\n\n*Example* Retrieve Iron Man's equipment list with the addition of some new boots.\n\n    r.table('marvel').get('IronMan')['equipment'].prepend('newBoots').run(conn)\n"),
	(rethinkdb.row, b"r.row -> value\n\nReturns the currently visited document.\n\n*Example* Get all users whose age is greater than 5.\n\n    r.table('users').filter(r.row['age'] > 5).run(conn)\n\n*Example* Access the attribute 'child' of an embedded document.\n\n    r.table('users').filter(r.row['embedded_doc']['child'] > 5).run(conn)\n\n*Example* Add 1 to every element of an array.\n\n    r.expr([1, 2, 3]).map(r.row + 1).run(conn)\n\n*Example* For nested queries, use functions instead of `row`.\n\n    r.table('users').filter(\n        lambda doc: doc['name'] == r.table('prizes').get('winner')\n    ).run(conn)\n\n"),
	(rethinkdb.ast.RqlQuery.set_difference, b"array.set_difference(array) -> array\n\nRemove the elements of one array from another and return them as a set (an array with\ndistinct values).\n\n*Example* Check which pieces of equipment Iron Man has, excluding a fixed list.\n\n    r.table('marvel').get('IronMan')['equipment'].set_difference(['newBoots', 'arc_reactor']).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.set_insert, b"array.set_insert(value) -> array\n\nAdd a value to an array and return it as a set (an array with distinct values).\n\n*Example* Retrieve Iron Man's equipment list with the addition of some new boots.\n\n    r.table('marvel').get('IronMan')['equipment'].set_insert('newBoots').run(conn)\n\n"),
	(rethinkdb.ast.RqlQuery.set_intersection, b"array.set_intersection(array) -> array\n\nIntersect two arrays returning values that occur in both of them as a set (an array with\ndistinct values).\n\n*Example* Check which pieces of equipment Iron Man has from a fixed list.\n\n    r.table('marvel').get('IronMan')['equipment'].set_intersection(['newBoots', 'arc_reactor']).run(conn)\n\n"),
	(rethinkdb.ast.RqlQuery.set_union, b"array.set_union(array) -> array\n\nAdd a several values to an array and return it as a set (an array with distinct values).\n\n*Example* Retrieve Iron Man's equipment list with the addition of some new boots and an arc reactor.\n\n    r.table('marvel').get('IronMan')['equipment'].set_union(['newBoots', 'arc_reactor']).run(conn)\n\n"),
	(rethinkdb.ast.RqlQuery.splice_at, b'array.splice_at(index, array) -> array\n\nInsert several values in to an array at a given index. Returns the modified array.\n\n*Example* Hulk and Thor decide to join the avengers.\n\n    r.expr(["Iron Man", "Spider-Man"]).splice_at(1, ["Hulk", "Thor"]).run(conn)\n'),
	(rethinkdb.ast.RqlQuery.values, b'singleSelection.values() -> array\nobject.values() -> array\n\nReturn an array containing all of an object\'s values. `values()` guarantees the values will come out in the same order as [keys](http://rethinkdb.com/api/python/keys).\n\n*Example* Get all of the values from a table row.\n\n    # row: { "id": 1, "mail": "fred@example.com", "name": "fred"  }\n    \n    r.table(\'users\').get(1).values().run(conn)\n    \n    > [ 1, "fred@example.com", "fred" ]\n'),
	(rethinkdb.ast.RqlQuery.without, b"sequence.without([selector1, selector2...]) -> stream\narray.without([selector1, selector2...]) -> array\nsingleSelection.without([selector1, selector2...]) -> object\nobject.without([selector1, selector2...]) -> object\n\nThe opposite of pluck; takes an object or a sequence of objects, and returns them with\nthe specified paths removed.\n\n*Example* Since we don't need it for this computation we'll save bandwidth and leave\nout the list of IronMan's romantic conquests.\n\n    r.table('marvel').get('IronMan').without('personalVictoriesList').run(conn)\n\n*Example* Without their prized weapons, our enemies will quickly be vanquished.\n\n    r.table('enemies').without('weapons').run(conn)\n\n*Example* Nested objects can be used to remove the damage subfield from the weapons and abilities fields.\n\n    r.table('marvel').without({'weapons' : {'damage' : True}, 'abilities' : {'damage' : True}}).run(conn)\n\n*Example* The nested syntax can quickly become overly verbose so there's a shorthand for it.\n\n    r.table('marvel').without({'weapons' : 'damage', 'abilities' : 'damage'}).run(conn)\n\n"),
	(rethinkdb.circle, b"r.circle([longitude, latitude], radius[, num_vertices=32, geo_system='WGS84', unit='m', fill=True]) -> geometry\nr.circle(point, radius[, {num_vertices=32, geo_system='WGS84', unit='m', fill=True]) -> geometry\n\nConstruct a circular line or polygon. A circle in RethinkDB is a polygon or line *approximating* a circle of a given radius around a given center, consisting of a specified number of vertices (default 32).\n\nThe center may be specified either by two floating point numbers, the latitude (&minus;90 to 90) and longitude (&minus;180 to 180) of the point on a perfect sphere (see [Geospatial support](http://rethinkdb.com/docs/geo-support/) for more information on ReQL's coordinate system), or by a point object. The radius is a floating point number whose units are meters by default, although that may be changed with the `unit` argument.\n\nOptional arguments available with `circle` are:\n\n* `num_vertices`: the number of vertices in the polygon or line. Defaults to 32.\n* `geo_system`: the reference ellipsoid to use for geographic coordinates. Possible values are `WGS84` (the default), a common standard for Earth's geometry, or `unit_sphere`, a perfect sphere of 1 meter radius.\n* `unit`: Unit for the radius distance. Possible values are `m` (meter, the default), `km` (kilometer), `mi` (international mile), `nm` (nautical mile), `ft` (international foot).\n* `fill`: if `True` (the default) the circle is filled, creating a polygon; if `False` the circle is unfilled (creating a line).\n\n*Example* Define a circle.\n\n    r.table('geo').insert({\n        'id': 300,\n        'name': 'Hayes Valley',\n        'neighborhood': r.circle([-122.423246, 37.779388], 1000)\n    }).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.distance, b"geometry.distance(geometry[, geo_system='WGS84', unit='m']) -> number\nr.distance(geometry, geometry[, geo_system='WGS84', unit='m']) -> number\n\nCompute the distance between a point and another geometry object. At least one of the geometry objects specified must be a point.\n\nOptional arguments available with `distance` are:\n\n* `geo_system`: the reference ellipsoid to use for geographic coordinates. Possible values are `WGS84` (the default), a common standard for Earth's geometry, or `unit_sphere`, a perfect sphere of 1 meter radius.\n* `unit`: Unit to return the distance in. Possible values are `m` (meter, the default), `km` (kilometer), `mi` (international mile), `nm` (nautical mile), `ft` (international foot).\n\nIf one of the objects is a polygon or a line, the point will be projected onto the line or polygon assuming a perfect sphere model before the distance is computed (using the model specified with `geo_system`). As a consequence, if the polygon or line is extremely large compared to Earth's radius and the distance is being computed with the default WGS84 model, the results of `distance` should be considered approximate due to the deviation between the ellipsoid and spherical models.\n\n*Example* Compute the distance between two points on the Earth in kilometers.\n\n    > point1 = r.point(-122.423246, 37.779388)\n    > point2 = r.point(-117.220406, 32.719464)\n    > r.distance(point1, point2, unit='km').run(conn)\n    \n    734.1252496021841\n"),
	(rethinkdb.ast.RqlQuery.fill, b"line.fill() -> polygon\n\nConvert a Line object into a Polygon object. If the last point does not specify the same coordinates as the first point, `polygon` will close the polygon by connecting them.\n\nLongitude (&minus;180 to 180) and latitude (&minus;90 to 90) of vertices are plotted on a perfect sphere. See [Geospatial support](http://rethinkdb.com/docs/geo-support/) for more information on ReQL's coordinate system.\n\nIf the last point does not specify the same coordinates as the first point, `polygon` will close the polygon by connecting them. You cannot directly construct a polygon with holes in it using `polygon`, but you can use [polygon_sub](http://rethinkdb.com/api/python/polygon_sub) to use a second polygon within the interior of the first to define a hole.\n\n*Example* Create a line object and then convert it to a polygon.\n\n    r.table('geo').insert({\n        'id': 201,\n        'rectangle': r.line(\n            [-122.423246, 37.779388],\n            [-122.423246, 37.329898],\n            [-121.886420, 37.329898],\n            [-121.886420, 37.779388]\n        )\n    }).run(conn)\n    \n    r.table('geo').get(201).update({\n        'rectangle': r.row['rectangle'].fill()\n    }, non_atomic=True).run(conn)\n"),
	(rethinkdb.geojson, b"r.geojson(geojson) -> geometry\n\nConvert a [GeoJSON](http://geojson.org) object to a ReQL geometry object.\n\nRethinkDB only allows conversion of GeoJSON objects which have ReQL equivalents: Point, LineString, and Polygon. MultiPoint, MultiLineString, and MultiPolygon are not supported. (You could, however, store multiple points, lines and polygons in an array and use a geospatial multi index with them.)\n\nOnly longitude/latitude coordinates are supported. GeoJSON objects that use Cartesian coordinates, specify an altitude, or specify their own coordinate reference system will be rejected.\n\n*Example* Convert a GeoJSON object to a ReQL geometry object.\n\n    geo_json = {\n        'type': 'Point',\n        'coordinates': [ -122.423246, 37.779388 ]\n    }\n    r.table('geo').insert({\n        'id': 'sfo',\n        'name': 'San Francisco',\n        'location': r.geojson(geo_json)\n    }).run(conn)\n"),
	(rethinkdb.ast.Table.get_intersecting, b"table.get_intersecting(geometry, index='indexname') -> selection<stream>\n\nGet all documents where the given geometry object intersects the geometry object of the requested geospatial index.\n\nThe `index` argument is mandatory. This command returns the same results as `table.filter(r.row('index').intersects(geometry))`. The total number of results is limited to the array size limit which defaults to 100,000, but can be changed with the `array_limit` option to [run](http://rethinkdb.com/api/python/run).\n\n*Example* Which of the locations in a list of parks intersect `circle1`?\n\n    circle1 = r.circle([-117.220406, 32.719464], 10, unit='mi')\n    r.table('parks').get_intersecting(circle1, index='area').run(conn)\n"),
	(rethinkdb.ast.Table.get_nearest, b"table.get_nearest(point, index='indexname'[, max_results=100, max_dist=100000, unit='m', geo_system='WGS84']) -> array\n\nGet all documents where the specified geospatial index is within a certain distance of the specified point (default 100 kilometers).\n\nThe `index` argument is mandatory. Optional arguments are:\n\n* `max_results`: the maximum number of results to return (default 100).\n* `unit`: Unit for the distance. Possible values are `m` (meter, the default), `km` (kilometer), `mi` (international mile), `nm` (nautical mile), `ft` (international foot).\n* `max_dist`: the maximum distance from an object to the specified point (default 100 km).\n* `geo_system`: the reference ellipsoid to use for geographic coordinates. Possible values are `WGS84` (the default), a common standard for Earth's geometry, or `unit_sphere`, a perfect sphere of 1 meter radius.\n\nThe return value will be an array of two-item objects with the keys `dist` and `doc`, set to the distance between the specified point and the document (in the units specified with `unit`, defaulting to meters) and the document itself, respectively.\n\n*Example* Return a list of enemy hideouts within 5000 meters of the secret base.\n\n    secret_base = r.point(-122.422876, 37.777128)\n    r.table('hideouts').get_nearest(secret_base, index='location',\n        max_dist=5000).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.includes, b"sequence.includes(geometry) -> sequence\ngeometry.includes(geometry) -> bool\n\nTests whether a geometry object is completely contained within another. When applied to a sequence of geometry objects, `includes` acts as a [filter](http://rethinkdb.com/api/python/filter), returning a sequence of objects from the sequence that include the argument.\n\n*Example* Is `point2` included within a 2000-meter circle around `point1`?\n\n    > point1 = r.point(-117.220406, 32.719464)\n    > point2 = r.point(-117.206201, 32.725186)\n    > r.circle(point1, 2000).includes(point2).run(conn)\n    \n    True\n\n*Example* Which of the locations in a list of parks include `circle1`?\n\n    circle1 = r.circle([-117.220406, 32.719464], 10, unit='mi')\n    r.table('parks')['area'].includes(circle1).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.intersects, b"sequence.intersects(geometry) -> sequence\ngeometry.intersects(geometry) -> bool\nr.intersects(sequence, geometry) -> sequence\nr.intersects(geometry, geometry) -> bool\n\nTests whether two geometry objects intersect with one another. When applied to a sequence of geometry objects, `intersects` acts as a [filter](http://rethinkdb.com/api/python/filter), returning a sequence of objects from the sequence that intersect with the argument.\n\n*Example* Is `point2` within a 2000-meter circle around `point1`?\n\n    > point1 = r.point(-117.220406, 32.719464)\n    > point2 = r.point(-117.206201, 32.725186)\n    > r.circle(point1, 2000).intersects(point2).run(conn)\n    \n    True\n\n*Example* Which of the locations in a list of parks intersect `circle1`?\n\n    circle1 = r.circle([-117.220406, 32.719464], 10, unit='mi')\n    r.table('parks')('area').intersects(circle1).run(conn)\n"),
	(rethinkdb.line, b"r.line([lon1, lat1], [lon2, lat2], ...) -> line\nr.line(point1, point2, ...) -> line\n\nConstruct a geometry object of type Line. The line can be specified in one of two ways:\n\n* Two or more two-item arrays, specifying latitude and longitude numbers of the line's vertices;\n* Two or more [Point](http://rethinkdb.com/api/python/point) objects specifying the line's vertices.\n\n<!-- break -->\n\nLongitude (&minus;180 to 180) and latitude (&minus;90 to 90) of vertices are plotted on a perfect sphere. See [Geospatial support](http://rethinkdb.com/docs/geo-support/) for more information on ReQL's coordinate system.\n\n*Example* Define a line.\n\n    r.table('geo').insert({\n        'id': 101,\n        'route': r.line([-122.423246, 37.779388], [-121.886420, 37.329898])\n    }).run(conn)\n\n*Example* Define a line using an array of points.\n\nYou can use the [args](http://rethinkdb.com/api/python/args) command to pass an array of Point objects (or latitude-longitude pairs) to `line`.\n\n    var route = [\n        [-122.423246, 37.779388],\n        [-121.886420, 37.329898]\n    ]\n    r.table('geo').insert({\n        'id': 102,\n        'route': r.line(r.args(route))\n    }).run(conn)\n"),
	(rethinkdb.point, b"r.point(longitude, latitude) -> point\n\nConstruct a geometry object of type Point. The point is specified by two floating point numbers, the longitude (&minus;180 to 180) and latitude (&minus;90 to 90) of the point on a perfect sphere. See [Geospatial support](http://rethinkdb.com/docs/geo-support/) for more information on ReQL's coordinate system.\n\n*Example* Define a point.\n\n    r.table('geo').insert({\n        'id': 1,\n        'name': 'San Francisco',\n        'location': r.point(-122.423246, 37.779388)\n    }).run(conn)\n"),
	(rethinkdb.polygon, b"r.polygon([lon1, lat1], [lon2, lat2], [lon3, lat3], ...) -> polygon\nr.polygon(point1, point2, point3, ...) -> polygon\n\nConstruct a geometry object of type Polygon. The Polygon can be specified in one of two ways:\n\n* Three or more two-item arrays, specifying latitude and longitude numbers of the polygon's vertices;\n* Three or more [Point](http://rethinkdb.com/api/python/point) objects specifying the polygon's vertices.\n\n<!-- break -->\n\nLongitude (&minus;180 to 180) and latitude (&minus;90 to 90) of vertices are plotted on a perfect sphere. See [Geospatial support](http://rethinkdb.com/docs/geo-support/) for more information on ReQL's coordinate system.\n\nIf the last point does not specify the same coordinates as the first point, `polygon` will close the polygon by connecting them. You cannot directly construct a polygon with holes in it using `polygon`, but you can use [polygon_sub](http://rethinkdb.com/api/python/polygon_sub) to use a second polygon within the interior of the first to define a hole.\n\n*Example* Define a polygon.\n\n    r.table('geo').insert({\n        'id': 101,\n        'rectangle': r.polygon(\n            [-122.423246, 37.779388],\n            [-122.423246, 37.329898],\n            [-121.886420, 37.329898],\n            [-121.886420, 37.779388]\n        )\n    }).run(conn)\n\n*Example* Define a polygon using an array of vertices.\n\nYou can use the [args](http://rethinkdb.com/api/python/args) command to pass an array of Point objects (or latitude-longitude pairs) to `polygon`.\n\n    vertices = [\n        [-122.423246, 37.779388],\n        [-122.423246, 37.329898],\n        [-121.886420, 37.329898],\n        [-121.886420, 37.779388]\n    ]\n    r.table('geo').insert({\n        'id': 102,\n        'rectangle': r.polygon(r.args(vertices))\n    }).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.polygon_sub, b'polygon1.polygon_sub(polygon2) -> polygon\n\nUse `polygon2` to "punch out" a hole in `polygon1`. `polygon2` must be completely contained within `polygon1` and must have no holes itself (it must not be the output of `polygon_sub` itself).\n\n*Example* Define a polygon with a hole punched in it.\n\n    outer_polygon = r.polygon(\n        [-122.4, 37.7],\n        [-122.4, 37.3],\n        [-121.8, 37.3],\n        [-121.8, 37.7]\n    )\n    inner_polygon = r.polygon(\n        [-122.3, 37.4],\n        [-122.3, 37.6],\n        [-122.0, 37.6],\n        [-122.0, 37.4]\n    )\n    outer_polygon.polygon_sub(inner_polygon).run(conn)\n'),
	(rethinkdb.ast.RqlQuery.to_geojson, b"geometry.to_geojson() -> object\n\nConvert a ReQL geometry object to a [GeoJSON](http://geojson.org) object.\n\n*Example* Convert a ReQL geometry object to a GeoJSON object.\n\n    > r.table('geo').get('sfo')['location'].to_geojson().run(conn)\n    \n    {\n        'type': 'Point',\n        'coordinates': [ -122.423246, 37.779388 ]\n    }\n"),
	(rethinkdb.ast.RqlQuery.eq_join, b'sequence.eq_join(left_field, right_table[, index=\'id\', ordered=False]) -> sequence\nsequence.eq_join(predicate_function, right_table[, index=\'id\', ordered=False]) -> sequence\n\nJoin tables using a field or function on the left-hand sequence matching primary keys or secondary indexes on the right-hand table. `eq_join` is more efficient than other ReQL join types, and operates much faster. Documents in the result set consist of pairs of left-hand and right-hand documents, matched when the field on the left-hand side exists and is non-null and an entry with that field\'s value exists in the specified index on the right-hand side.\n\nThe result set of `eq_join` is a stream or array of objects. Each object in the returned set will be an object of the form `{ left: <left-document>, right: <right-document> }`, where the values of `left` and `right` will be the joined documents. Use the <code><a href="/api/python/zip/">zip</a></code> command to merge the `left` and `right` fields together.\n\nThe results from `eq_join` are, by default, not ordered. The optional `ordered=True` parameter will cause `eq_join` to order the output based on the left side input stream. (If there are multiple matches on the right side for a document on the left side, their order is not guaranteed even if `ordered` is `True`.) Requiring ordered results can significantly slow down `eq_join`, and in many circumstances this ordering will not be required. (See the first example, in which ordered results are obtained by using `order_by` after `eq_join`.)\n\nSuppose the players table contains these documents:\n\n    [\n        { \'id\': 1, \'player\': \'George\', \'gameId\': 1 },\n        { \'id\': 2, \'player\': \'Agatha\', \'gameId\': 3 },\n        { \'id\': 3, \'player\': \'Fred\', \'gameId\': 2 },\n        { \'id\': 4, \'player\': \'Marie\', \'gameId\': 2 },\n        { \'id\': 5, \'player\': \'Earnest\', \'gameId\': 1 },\n        { \'id\': 6, \'player\': \'Beth\', \'gameId\': 3 }\n    ]\n\nThe games table contains these documents:\n\n    [\n        { \'id\': 1, \'field\': \'Little Delving\' },\n        { \'id\': 2, \'field\': \'Rushock Bog\' },\n        { \'id\': 3, \'field\': \'Bucklebury\' }\n    ]\n\n**Example:** Match players with the games they\'ve played against one another.\n\nJoin these tables using `game_id` on the player table and `id` on the games table:\n\n    r.table(\'players\').eq_join(\'game_id\', r.table(\'games\')).run(conn)\n\nThis will return a result set such as the following:\n\n    [\n        {\n            "left" : { "gameId" : 3, "id" : 2, "player" : "Agatha" },\n            "right" : { "id" : 3, "field" : "Bucklebury" }\n        },\n        {\n            "left" : { "gameId" : 2, "id" : 3, "player" : "Fred" },\n            "right" : { "id" : 2, "field" : "Rushock Bog" }\n        },\n        ...\n    ]\n\n<!-- stop -->\n\nWhat you likely want is the result of using `zip` with that. For clarity, we\'ll use `without` to drop the `id` field from the games table (it conflicts with the `id` field for the players and it\'s redundant anyway), and we\'ll order it by the games.\n\n    r.table(\'players\').eq_join(\'game_id\', r.table(\'games\')).without({\'right\': "id"}).zip().order_by(\'game_id\').run(conn)\n    \n    [\n        { "field": "Little Delving", "gameId": 1, "id": 5, "player": "Earnest" },\n        { "field": "Little Delving", "gameId": 1, "id": 1, "player": "George" },\n        { "field": "Rushock Bog", "gameId": 2, "id": 3, "player": "Fred" },\n        { "field": "Rushock Bog", "gameId": 2, "id": 4, "player": "Marie" },\n        { "field": "Bucklebury", "gameId": 3, "id": 6, "player": "Beth" },\n        { "field": "Bucklebury", "gameId": 3, "id": 2, "player": "Agatha" }\n    ]\n\nFor more information, see [Table joins in RethinkDB](http://rethinkdb.com/docs/table-joins/).\n\n**Example:** Use a secondary index on the right table rather than the primary key. If players have a secondary index on their cities, we can get a list of arenas with players in the same area.\n\n    r.table(\'arenas\').eq_join(\'city_id\', r.table(\'arenas\'), index=\'city_id\').run(conn)\n\n**Example:** Use a nested key as the join field. Suppose the documents in the players table were structured like this:\n\n    { \'id\': 1, \'player\': \'George\', \'game\': {\'id\': 1} },\n    { \'id\': 2, \'player\': \'Agatha\', \'game\': {\'id\': 3} },\n    ...\n\nSimply specify the field using the `row` command instead of a string.\n\n    r.table(\'players\').eq_join(r.row[\'game\'][\'id\'], r.table(\'games\')).without({\'right\': \'id\'}).zip().run(conn)\n    \n    [\n        { "field": "Little Delving", "game": { "id": 1 }, "id": 5, "player": "Earnest" },\n        { "field": "Little Delving", "game": { "id": 1 }, "id": 1, "player": "George" },\n        ...\n    ]\n\n**Example:** Use a function instead of a field to join on a more complicated expression. Suppose the players have lists of favorite games ranked in order in a field such as `"favorites": [3, 2, 1]`. Get a list of players and their top favorite:\n\n    r.table(\'players3\').eq_join(\n        lambda player: player[\'favorites\'].nth(0),\n        r.table(\'games\')\n    ).without([{\'left\': [\'favorites\', \'game_id\', \'id\']}, {\'right\': \'id\'}]).zip()\n\nResult:\n\n    [\n    \t{ "field": "Rushock Bog", "name": "Fred" },\n    \t{ "field": "Little Delving", "name": "George" },\n    \t...\n    ]\n'),
	(rethinkdb.ast.RqlQuery.inner_join, b"sequence.inner_join(other_sequence, predicate_function) -> stream\narray.inner_join(other_sequence, predicate_function) -> array\n\nReturns an inner join of two sequences.\n\nThe returned sequence represents an intersection of the left-hand sequence and the right-hand sequence: each row of the left-hand sequence will be compared with each row of the right-hand sequence to find all pairs of rows which satisfy the predicate. Each matched pair of rows of both sequences are combined into a result row. In most cases, you will want to follow the join with [zip](http://rethinkdb.com/api/python/zip) to combine the left and right results.\n\n*Example* Return a list of all matchups between Marvel and DC heroes in which the DC hero could beat the Marvel hero in a fight.\n\n    r.table('marvel').inner_join(r.table('dc'),\n        lambda marvel_row, dc_row: marvel_row['strength'] < dc_row['strength']\n    ).zip().run(conn)\n\n<!-- stop -->\n\n(Compare this to an [outer_join](http://rethinkdb.com/api/python/outer_join) with the same inputs and predicate, which would return a list of *all* Marvel heroes along with any DC heroes with a higher strength.)"),
	(rethinkdb.ast.RqlQuery.outer_join, b"sequence.outer_join(other_sequence, predicate_function) -> stream\narray.outer_join(other_sequence, predicate_function) -> array\n\nReturns a left outer join of two sequences. The returned sequence represents a union of the left-hand sequence and the right-hand sequence: all documents in the left-hand sequence will be returned, each matched with a document in the right-hand sequence if one satisfies the predicate condition. In most cases, you will want to follow the join with [zip](http://rethinkdb.com/api/python/zip) to combine the left and right results.\n\n*Example* Return a list of all Marvel heroes, paired with any DC heroes who could beat them in a fight.\n\n    r.table('marvel').outer_join(r.table('dc'),\n      lambda marvel_row, dc_row: marvel_row['strength'] < dc_row['strength']\n    ).zip().run(conn)\n\n(Compare this to an [inner_join](http://rethinkdb.com/api/python/inner_join) with the same inputs and predicate, which would return a list only of the matchups in which the DC hero has the higher strength.)\n"),
	(rethinkdb.ast.RqlQuery.zip, b"stream.zip() -> stream\narray.zip() -> array\n\nUsed to 'zip' up the result of a join by merging the 'right' fields into 'left' fields of each member of the sequence.\n\n*Example* 'zips up' the sequence by merging the left and right fields produced by a join.\n\n    r.table('marvel').eq_join('main_dc_collaborator', r.table('dc')).zip().run(conn)\n"),
	(rethinkdb.db_create, b'r.db_create(db_name) -> object\n\nCreate a database. A RethinkDB database is a collection of tables, similar to\nrelational databases.\n\nIf successful, the command returns an object with two fields:\n\n* `dbs_created`: always `1`.\n* `config_changes`: a list containing one object with two fields, `old_val` and `new_val`:\n    * `old_val`: always `None`.\n    * `new_val`: the database\'s new [config](http://rethinkdb.com/api/python/config) value.\n\nIf a database with the same name already exists, the command throws `ReqlRuntimeError`.\n\nNote: Only alphanumeric characters and underscores are valid for the database name.\n\n*Example* Create a database named \'superheroes\'.\n\n    r.db_create(\'superheroes\').run(conn)\n    \n    {\n        "config_changes": [\n            {\n                "new_val": {\n                    "id": "e4689cfc-e903-4532-a0e6-2d6797a43f07",\n                    "name": "superheroes"\n                },\n                "old_val": None\n            }\n        ],\n        "dbs_created": 1\n    }\n\n'),
	(rethinkdb.db_drop, b'r.db_drop(db_name) -> object\n\nDrop a database. The database, all its tables, and corresponding data will be deleted.\n\nIf successful, the command returns an object with two fields:\n\n* `dbs_dropped`: always `1`.\n* `tables_dropped`: the number of tables in the dropped database.\n* `config_changes`: a list containing one two-field object, `old_val` and `new_val`:\n    * `old_val`: the database\'s original [config](http://rethinkdb.com/api/python/config) value.\n    * `new_val`: always `None`.\n\nIf the given database does not exist, the command throws `ReqlRuntimeError`.\n\n*Example* Drop a database named \'superheroes\'.\n\n    r.db_drop(\'superheroes\').run(conn)\n    \n    {\n        "config_changes": [\n            {\n                "old_val": {\n                    "id": "e4689cfc-e903-4532-a0e6-2d6797a43f07",\n                    "name": "superheroes"\n                },\n                "new_val": None\n            }\n        ],\n        "tables_dropped": 3,\n        "dbs_dropped": 1\n    }\n\n'),
	(rethinkdb.db_list, b'r.db_list() -> array\n\nList all database names in the system. The result is a list of strings.\n\n*Example* List all databases.\n\n    r.db_list().run(conn)\n\n'),
	(rethinkdb.ast.RqlQuery.changes, b'stream.changes([options]) -> stream\nsingleSelection.changes([options]) -> stream\n\nTurn a query into a changefeed, an infinite stream of objects representing changes to the query\'s results as they occur. A changefeed may return changes to a table or an individual document (a "point" changefeed). Commands such as `filter` or `map` may be used before the `changes` command to transform or filter the output, and many commands that operate on sequences can be chained after `changes`.\n\nThere are four optional arguments to `changes`.\n\n* `squash`: Controls how change notifications are batched. Acceptable values are `True`, `False` and a numeric value:\n    * `True`: When multiple changes to the same document occur before a batch of notifications is sent, the changes are "squashed" into one change. The client receives a notification that will bring it fully up to date with the server.\n    * `False`: All changes will be sent to the client verbatim. This is the default.\n    * `n`: A numeric value (floating point). Similar to `True`, but the server will wait `n` seconds to respond in order to squash as many changes together as possible, reducing network traffic. The first batch will always be returned immediately.\n* `changefeed_queue_size`: the number of changes the server will buffer between client reads before it starts dropping changes and generates an error (default: 100,000).\n* `include_initial`: if `True`, the changefeed stream will begin with the current contents of the table or selection being monitored. These initial results will have `new_val` fields, but no `old_val` fields. The initial results may be intermixed with actual changes, as long as an initial result for the changed document has already been given. If an initial result for a document has been sent and a change is made to that document that would move it to the unsent part of the result set (e.g., a changefeed monitors the top 100 posters, the first 50 have been sent, and poster 48 has become poster 52), an "uninitial" notification will be sent, with an `old_val` field but no `new_val` field.\n* `include_states`: if `True`, the changefeed stream will include special status documents consisting of the field `state` and a string indicating a change in the feed\'s state. These documents can occur at any point in the feed between the notification documents described below. If `include_states` is `False` (the default), the status documents will not be sent.\n* `include_offsets`: if `True`, a changefeed stream on an `order_by.limit` changefeed will include `old_offset` and `new_offset` fields in status documents that include `old_val` and `new_val`. This allows applications to maintain ordered lists of the stream\'s result set. If `old_offset` is set and not `None`, the element at `old_offset` is being deleted; if `new_offset` is set and not `None`, then `new_val` is being inserted at `new_offset`. Setting `include_offsets` to `True` on a changefeed that does not support it will raise an error.\n\nThere are currently two states:\n\n* `{"state": "initializing"}` indicates the following documents represent initial values on the feed rather than changes. This will be the first document of a feed that returns initial values.\n* `{"state": "ready"}` indicates the following documents represent changes. This will be the first document of a feed that does *not* return initial values; otherwise, it will indicate the initial values have all been sent.\n\nIf the table becomes unavailable, the changefeed will be disconnected, and a runtime exception will be thrown by the driver.\n\nChangefeed notifications take the form of a two-field object:\n\n    {\n        "old_val": <document before change>,\n        "new_val": <document after change>\n    }\n\nWhen a document is deleted, `new_val` will be `None`; when a document is inserted, `old_val` will be `None`.\n\nThe server will buffer up to 100,000 elements. If the buffer limit is hit, early changes will be discarded, and the client will receive an object of the form `{"error": "Changefeed cache over array size limit, skipped X elements."}` where `X` is the number of elements skipped.\n\nCommands that operate on streams (such as [filter](http://rethinkdb.com/api/python/filter/) or [map](http://rethinkdb.com/api/python/map/)) can usually be chained after `changes`.  However, since the stream produced by `changes` has no ending, commands that need to consume the entire stream before returning (such as [reduce](http://rethinkdb.com/api/python/reduce/) or [count](http://rethinkdb.com/api/python/count/)) cannot.\n\n*Example* Subscribe to the changes on a table.\n\nStart monitoring the changefeed in one client:\n\n    for change in r.table(\'games\').changes().run(conn):\n      print change\n\nAs these queries are performed in a second client, the first client would receive and print the following objects:\n\n    > r.table(\'games\').insert({\'id\': 1}).run(conn)\n    {\'old_val\': None, \'new_val\': {\'id\': 1}}\n    \n    > r.table(\'games\').get(1).update({\'player1\': \'Bob\'}).run(conn)\n    {\'old_val\': {\'id\': 1}, \'new_val\': {\'id\': 1, \'player1\': \'Bob\'}}\n    \n    > r.table(\'games\').get(1).replace({\'id\': 1, \'player1\': \'Bob\', \'player2\': \'Alice\'}).run(conn)\n    {\'old_val\': {\'id\': 1, \'player1\': \'Bob\'},\n     \'new_val\': {\'id\': 1, \'player1\': \'Bob\', \'player2\': \'Alice\'}}\n    \n    > r.table(\'games\').get(1).delete().run(conn)\n    {\'old_val\': {\'id\': 1, \'player1\': \'Bob\', \'player2\': \'Alice\'}, \'new_val\': None}\n    \n    > r.table_drop(\'games\').run(conn)\n    ReqlRuntimeError: Changefeed aborted (table unavailable)\n\n*Example* Return all the changes that increase a player\'s score.\n\n    r.table(\'test\').changes().filter(\n      r.row[\'new_val\'][\'score\'] > r.row[\'old_val\'][\'score\']\n    ).run(conn)\n\n*Example* Return all the changes to a specific player\'s score that increase it past 10.\n\n    r.table(\'test\').get(1).filter(r.row[\'score\'].gt(10)).changes().run(conn)\n\n*Example* Return all the inserts on a table.\n\n    r.table(\'test\').changes().filter(r.row[\'old_val\'].eq(None)).run(conn)\n\n*Example* Return all the changes to game 1, with state notifications and initial values.\n\n    r.table(\'games\').get(1).changes(include_initial=True, include_states=True).run(conn)\n    \n    # result returned on changefeed\n    {"state": "initializing"}\n    {"new_val": {"id": 1, "score": 12, "arena": "Hobbiton Field"}}\n    {"state": "ready"}\n    {\n    \t"old_val": {"id": 1, "score": 12, "arena": "Hobbiton Field"},\n    \t"new_val": {"id": 1, "score": 14, "arena": "Hobbiton Field"}\n    }\n    {\n    \t"old_val": {"id": 1, "score": 14, "arena": "Hobbiton Field"},\n    \t"new_val": {"id": 1, "score": 17, "arena": "Hobbiton Field", "winner": "Frodo"}\n    }\n\n*Example* Return all the changes to the top 10 games. This assumes the presence of a `score` secondary index on the `games` table.\n\n    r.table(\'games\').order_by(index=r.desc(\'score\')).limit(10).changes().run(conn)\n'),
	(rethinkdb.ast.Table.index_create, b'table.index_create(index_name[, index_function][, multi=False, geo=False]) -> object\n\nCreate a new secondary index on a table. Secondary indexes improve the speed of many read queries at the slight cost of increased storage space and decreased write performance. For more information about secondary indexes, read the article "[Using secondary indexes in RethinkDB](http://rethinkdb.com/docs/secondary-indexes/)."\n\nRethinkDB supports different types of secondary indexes:\n\n- *Simple indexes* based on the value of a single field.\n- *Compound indexes* based on multiple fields.\n- *Multi indexes* based on arrays of values.\n- *Geospatial indexes* based on indexes of geometry objects, created when the `geo` optional argument is true.\n- Indexes based on *arbitrary expressions*.\n\nThe `index_function` can be an anonymous function or a binary representation obtained from the `function` field of [index_status](http://rethinkdb.com/api/python/index_status).\n\nIf successful, `create_index` will return an object of the form `{"created": 1}`. If an index by that name already exists on the table, a `ReqlRuntimeError` will be thrown.\n\n*Example* Create a simple index based on the field `post_id`.\n\n    r.table(\'comments\').index_create(\'post_id\').run(conn)\n*Example* Create a simple index based on the nested field `author > name`.\n\n    r.table(\'comments\').index_create(\'author_name\', r.row["author"]["name"]).run(conn)\n\n*Example* Create a geospatial index based on the field `location`.\n\n    r.table(\'places\').index_create(\'location\', geo=True).run(conn)\n\nA geospatial index field should contain only geometry objects. It will work with geometry ReQL terms ([get_intersecting](http://rethinkdb.com/api/python/get_intersecting/) and [get_nearest](http://rethinkdb.com/api/python/get_nearest/)) as well as index-specific terms ([index_status](http://rethinkdb.com/api/python/index_status), [index_wait](http://rethinkdb.com/api/python/index_wait), [index_drop](http://rethinkdb.com/api/python/index_drop) and [index_list](http://rethinkdb.com/api/python/index_list)). Using terms that rely on non-geometric ordering such as [get_all](http://rethinkdb.com/api/python/get_all/), [order_by](http://rethinkdb.com/api/python/order_by/) and [between](http://rethinkdb.com/api/python/between/) will result in an error.\n\n*Example* Create a compound index based on the fields `post_id` and `date`.\n\n    r.table(\'comments\').index_create(\'post_and_date\', [r.row["post_id"], r.row["date"]]).run(conn)\n\n*Example* Create a multi index based on the field `authors`.\n\n    r.table(\'posts\').index_create(\'authors\', multi=True).run(conn)\n\n*Example* Create a geospatial multi index based on the field `towers`.\n\n    r.table(\'networks\').index_create(\'towers\', geo=True, multi=True).run(conn)\n\n*Example* Create an index based on an arbitrary expression.\n\n    r.table(\'posts\').index_create(\'authors\', lambda doc:\n        r.branch(\n            doc.has_fields("updated_at"),\n            doc["updated_at"],\n            doc["created_at"]\n        )\n    ).run(conn)\n\n*Example* Create a new secondary index based on an existing one.\n\n    index = r.table(\'posts\').index_status(\'authors\').nth(0)[\'function\'].run(conn)\n    r.table(\'new_posts\').index_create(\'authors\', index).run(conn)\n\n*Example* Rebuild an outdated secondary index on a table.\n\n    old_index = r.table(\'posts\').index_status(\'old_index\').nth(0)[\'function\'].run(conn)\n    r.table(\'posts\').index_create(\'new_index\', old_index).run(conn)\n    r.table(\'posts\').index_wait(\'new_index\').run(conn)\n    r.table(\'posts\').index_rename(\'new_index\', \'old_index\', overwrite=True).run(conn)\n'),
	(rethinkdb.ast.Table.index_drop, b"table.index_drop(index_name) -> object\n\nDelete a previously created secondary index of this table.\n\n*Example* Drop a secondary index named 'code_name'.\n\n    r.table('dc').index_drop('code_name').run(conn)\n\n"),
	(rethinkdb.ast.Table.index_list, b"table.index_list() -> array\n\nList all the secondary indexes of this table.\n\n*Example* List the available secondary indexes for this table.\n\n    r.table('marvel').index_list().run(conn)\n"),
	(rethinkdb.ast.Table.index_rename, b"table.index_rename(old_index_name, new_index_name[, overwrite=False]) -> object\n\nRename an existing secondary index on a table. If the optional argument `overwrite` is specified as `True`, a previously existing index with the new name will be deleted and the index will be renamed. If `overwrite` is `False` (the default) an error will be raised if the new index name already exists.\n\nThe return value on success will be an object of the format `{'renamed': 1}`, or `{'renamed': 0}` if the old and new names are the same.\n\nAn error will be raised if the old index name does not exist, if the new index name is already in use and `overwrite` is `False`, or if either the old or new index name are the same as the primary key field name.\n\n*Example* Rename an index on the comments table.\n\n    r.table('comments').index_rename('post_id', 'message_id').run(conn)\n"),
	(rethinkdb.ast.Table.index_status, b'table.index_status([, index...]) -> array\n\nGet the status of the specified indexes on this table, or the status\nof all indexes on this table if no indexes are specified.\n\nThe result is an array where for each index, there will be an object like this one:\n\n    {\n        "index": <index_name>,\n        "ready": True,\n        "function": <binary>,\n        "multi": <bool>,\n        "outdated": <bool>\n    }\n\nor this one:\n\n    {\n        "index": <index_name>,\n        "ready": False,\n        "progress": <float>,\n        "function": <binary>,\n        "multi": <bool>,\n        "outdated": <bool>\n    }\n\nThe `multi` field will be `true` or `false` depending on whether this index was created as a multi index (see [index_create](http://rethinkdb.com/api/python/index_create/) for details). The `outdated` field will be true if the index is outdated in the current version of RethinkDB and needs to be rebuilt. The `progress` field is a float between `0` and `1`, indicating how far along the server is in constructing indexes after the most recent change to the table that would affect them. (`0` indicates no such indexes have been constructed; `1` indicates all of them have.)\n\nThe `function` field is a binary object containing an opaque representation of the secondary index (including the `multi` argument if specified). It can be passed as the second argument to [index_create](http://rethinkdb.com/api/python/index_create/) to create a new index with the same function; see `index_create` for more information.\n\n*Example* Get the status of all the indexes on `test`:\n\n    r.table(\'test\').index_status().run(conn)\n\n*Example* Get the status of the `timestamp` index:\n\n    r.table(\'test\').index_status(\'timestamp\').run(conn)\n\n*Example* Save the binary representation of the index:\n\n    func = r.table(\'test\').index_status(\'timestamp\').nth(0)[\'function\'].run(conn)\n'),
	(rethinkdb.ast.Table.index_wait, b'table.index_wait([, index...]) -> array\n\nWait for the specified indexes on this table to be ready, or for all\nindexes on this table to be ready if no indexes are specified.\n\nThe result is an array containing one object for each table index:\n\n    {\n        "index": <index_name>,\n        "ready": True,\n        "function": <binary>,\n        "multi": <bool>,\n        "geo": <bool>,\n        "outdated": <bool>\n    }\n\nSee the [index_status](http://rethinkdb.com/api/python/index_status) documentation for a description of the field values.\n\n*Example* Wait for all indexes on the table `test` to be ready:\n\n    r.table(\'test\').index_wait().run(conn)\n\n*Example* Wait for the index `timestamp` to be ready:\n\n    r.table(\'test\').index_wait(\'timestamp\').run(conn)\n'),
	(rethinkdb.ast.DB.table_create, b'db.table_create(table_name[, options]) -> object\nr.table_create(table_name[, options]) -> object\n\nCreate a table. A RethinkDB table is a collection of JSON documents.\n\nIf successful, the command returns an object with two fields:\n\n* `tables_created`: always `1`.\n* `config_changes`: a list containing one two-field object, `old_val` and `new_val`:\n    * `old_val`: always `None`.\n    * `new_val`: the table\'s new [config](http://rethinkdb.com/api/python/config) value.\n\nIf a table with the same name already exists, the command throws `ReqlOpFailedError`.\n\nWhen creating a table you can specify the following options:\n\n* `primary_key`: the name of the primary key. The default primary key is `id`.\n* `durability`: if set to `soft`, writes will be acknowledged by the server immediately and flushed to disk in the background. The default is `hard`: acknowledgment of writes happens after data has been written to disk.\n* `shards`: the number of shards, an integer from 1-64. Defaults to `1`.\n* `replicas`: either an integer or a mapping object. Defaults to `1`.\n    * If `replicas` is an integer, it specifies the number of replicas per shard. Specifying more replicas than there are servers will return an error.\n    * If `replicas` is an object, it specifies key-value pairs of server tags and the number of replicas to assign to those servers: `{\'tag1\': 2, \'tag2\': 4, \'tag3\': 2, ...}`.\n* `primary_replica_tag`: the primary server specified by its server tag. Required if `replicas` is an object; the tag must be in the object. This must *not* be specified if `replicas` is an integer.\n\nThe data type](http://rethinkdb.com/docs/data-types/) of a primary key is usually a string (like a UUID) or a number, but it can also be a time, binary object, boolean or an array. Data types can be mixed in the primary key field, but all values must be unique. Using an array as a primary key creates a compound index; read the documentation on [compound secondary indexes for more information, as it applies to primary keys as well. Primary keys cannot be objects.\n\nTables will be available for writing when the command returns.\n\n*Example* Create a table named \'dc_universe\' with the default settings.\n\n    r.db(\'heroes\').table_create(\'dc_universe\').run(conn)\n    \n    {\n        "config_changes": [\n            {\n                "new_val": {\n                    "db": "test",\n                    "durability":  "hard",\n                    "id": "20ea60d4-3b76-4817-8828-98a236df0297",\n                    "name": "dc_universe",\n                    "primary_key": "id",\n                    "shards": [\n                        {\n                            "primary_replica": "rethinkdb_srv1",\n                            "replicas": [\n                                "rethinkdb_srv1",\n                                "rethinkdb_srv2"\n                            ]\n                        }\n                    ],\n                    "write_acks": "majority"\n                },\n                "old_val": None\n            }\n        ],\n        "tables_created": 1\n    }\n\n*Example* Create a table named \'dc_universe\' using the field \'name\' as primary key.\n\n    r.db(\'test\').table_create(\'dc_universe\', primary_key=\'name\').run(conn)\n\n*Example* Create a table set up for two shards and three replicas per shard. This requires three available servers.\n\n    r.db(\'test\').table_create(\'dc_universe\', shards=2, replicas=3).run(conn)\n\nRead [Sharding and replication](http://rethinkdb.com/docs/sharding-and-replication/) for a complete discussion of the subject, including advanced topics.\n'),
	(rethinkdb.ast.DB.table_drop, b'db.table_drop(table_name) -> object\n\nDrop a table. The table and all its data will be deleted.\n\nIf successful, the command returns an object with two fields:\n\n* `tables_dropped`: always `1`.\n* `config_changes`: a list containing one two-field object, `old_val` and `new_val`:\n    * `old_val`: the dropped table\'s [config](http://rethinkdb.com/api/python/config) value.\n    * `new_val`: always `None`.\n\nIf the given table does not exist in the database, the command throws `ReqlRuntimeError`.\n\n*Example* Drop a table named \'dc_universe\'.\n\n    r.db(\'test\').table_drop(\'dc_universe\').run(conn)\n    \n    {\n        "config_changes": [\n            {\n                "old_val": {\n                    "db": "test",\n                    "durability":  "hard",\n                    "id": "20ea60d4-3b76-4817-8828-98a236df0297",\n                    "name": "dc_universe",\n                    "primary_key": "id",\n                    "shards": [\n                        {\n                            "primary_replica": "rethinkdb_srv1",\n                            "replicas": [\n                                "rethinkdb_srv1",\n                                "rethinkdb_srv2"\n                            ]\n                        }\n                    ],\n                    "write_acks": "majority"\n                },\n                "new_val": None\n            }\n        ],\n        "tables_dropped": 1\n    }\n'),
	(rethinkdb.ast.DB.table_list, b"db.table_list() -> array\n\nList all table names in a database. The result is a list of strings.\n\n*Example* List all tables of the 'test' database.\n\n    r.db('test').table_list().run(conn)\n    \n"),
	(rethinkdb.ast.RqlQuery.__add__, b'value + value -> value\ntime + number -> time\nvalue.add(value[, value, ...]) -> value\ntime.add(number[, number, ...]) -> time\n\nSum two or more numbers, or concatenate two or more strings or arrays.\n\nThe `add` command can be called in either prefix or infix form; both forms are equivalent. Note that ReQL will not perform type coercion. You cannot, for example, `add` a string and a number together.\n\n*Example* It\'s as easy as 2 + 2 = 4.\n\n    > (r.expr(2) + 2).run(conn)\n    \n    4\n\n*Example* Concatenate strings.\n\n    > (r.expr("foo") + "bar" + "baz").run(conn)\n    \n    "foobarbaz"\n\n*Example* Concatenate arrays.\n\n    > (r.expr(["foo", "bar"]) + ["buzz"]).run(conn)\n    \n    ["foo", "bar", "buzz"]\n\n*Example* Create a date one year from now.\n\n    (r.now() + 365*24*60*60).run(conn)\n\n*Example* Use [args](http://rethinkdb.com/api/python/args) with `add` to sum multiple values.\n\n    > vals = [10, 20, 30]\n    > r.add(r.args(vals)).run(conn)\n    \n    60\n\n*Example* Concatenate an array of strings with `args`.\n\n    > vals = [\'foo\', \'bar\', \'buzz\']\n    > r.add(r.args(vals)).run(conn)\n    \n    "foobarbuzz"\n'),
	(rethinkdb.add, b'value + value -> value\ntime + number -> time\nvalue.add(value[, value, ...]) -> value\ntime.add(number[, number, ...]) -> time\n\nSum two or more numbers, or concatenate two or more strings or arrays.\n\nThe `add` command can be called in either prefix or infix form; both forms are equivalent. Note that ReQL will not perform type coercion. You cannot, for example, `add` a string and a number together.\n\n*Example* It\'s as easy as 2 + 2 = 4.\n\n    > (r.expr(2) + 2).run(conn)\n    \n    4\n\n*Example* Concatenate strings.\n\n    > (r.expr("foo") + "bar" + "baz").run(conn)\n    \n    "foobarbaz"\n\n*Example* Concatenate arrays.\n\n    > (r.expr(["foo", "bar"]) + ["buzz"]).run(conn)\n    \n    ["foo", "bar", "buzz"]\n\n*Example* Create a date one year from now.\n\n    (r.now() + 365*24*60*60).run(conn)\n\n*Example* Use [args](http://rethinkdb.com/api/python/args) with `add` to sum multiple values.\n\n    > vals = [10, 20, 30]\n    > r.add(r.args(vals)).run(conn)\n    \n    60\n\n*Example* Concatenate an array of strings with `args`.\n\n    > vals = [\'foo\', \'bar\', \'buzz\']\n    > r.add(r.args(vals)).run(conn)\n    \n    "foobarbuzz"\n'),
	(rethinkdb.ast.RqlQuery.__and__, b'bool & bool -> bool\nbool.and_([bool, bool, ...]) -> bool\nr.and_([bool, bool, ...]) -> bool\n\nCompute the logical "and" of one or more values.\n\nThe `and_` command can be used as an infix operator after its first argument (`r.expr(True).and_(False)`) or given all of its arguments as parameters (`r.and_(True, False)`). The standard Python and operator, `&`, may also be used with ReQL.\n\nCalling `and_` with zero arguments will return `True`.\n\n*Example* Return whether both `a` and `b` evaluate to true.\n\n    > a = True\n    > b = False\n    > (r.expr(a) & b).run(conn)\n    \n    False\n*Example* Return whether all of `x`, `y` and `z` evaluate to true.\n\n    > x = True\n    > y = True\n    > z = True\n    > r.and_(x, y, z).run(conn)\n    \n    True\n'),
	(rethinkdb.and_, b'bool & bool -> bool\nbool.and_([bool, bool, ...]) -> bool\nr.and_([bool, bool, ...]) -> bool\n\nCompute the logical "and" of one or more values.\n\nThe `and_` command can be used as an infix operator after its first argument (`r.expr(True).and_(False)`) or given all of its arguments as parameters (`r.and_(True, False)`). The standard Python and operator, `&`, may also be used with ReQL.\n\nCalling `and_` with zero arguments will return `True`.\n\n*Example* Return whether both `a` and `b` evaluate to true.\n\n    > a = True\n    > b = False\n    > (r.expr(a) & b).run(conn)\n    \n    False\n*Example* Return whether all of `x`, `y` and `z` evaluate to true.\n\n    > x = True\n    > y = True\n    > z = True\n    > r.and_(x, y, z).run(conn)\n    \n    True\n'),
	(rethinkdb.ast.RqlQuery.ceil, b"r.ceil(number) -> number\nnumber.ceil() -> number\n\nRounds the given value up, returning the smallest integer value greater than or equal to the given value (the value's ceiling).\n\n*Example* Return the ceiling of 12.345.\n\n    > r.ceil(12.345).run(conn)\n    \n    13.0\n\nThe `ceil` command can also be chained after an expression.\n\n*Example* Return the ceiling of -12.345.\n\n    > r.expr(-12.345).ceil().run(conn)\n    \n    -12.0\n\n*Example* Return Iron Man's weight, rounded up with `ceil`.\n\n    r.table('superheroes').get('ironman')['weight'].ceil().run(conn)\n"),
	(rethinkdb.ast.RqlQuery.__div__, b"number / number -> number\nnumber.div(number[, number ...]) -> number\n\nDivide two numbers.\n\n*Example* It's as easy as 2 / 2 = 1.\n\n    (r.expr(2) / 2).run(conn)\n"),
	(rethinkdb.div, b"number / number -> number\nnumber.div(number[, number ...]) -> number\n\nDivide two numbers.\n\n*Example* It's as easy as 2 / 2 = 1.\n\n    (r.expr(2) / 2).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.__eq__, b"value.eq(value[, value, ...]) -> bool\nvalue == value -> bool\n\nTest if two or more values are equal.\n\n*Example* See if a user's `role` field is set to `administrator`. \n\n    r.table('users').get(1)['role'].eq('administrator').run(conn)\n    # alternative syntax\n    (r.table('users').get(1)['role'] == 'administrator').run(conn)\n\n*Example* See if three variables contain equal values.\n\n    r.eq(a, b, c).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.eq, b"value.eq(value[, value, ...]) -> bool\nvalue == value -> bool\n\nTest if two or more values are equal.\n\n*Example* See if a user's `role` field is set to `administrator`. \n\n    r.table('users').get(1)['role'].eq('administrator').run(conn)\n    # alternative syntax\n    (r.table('users').get(1)['role'] == 'administrator').run(conn)\n\n*Example* See if three variables contain equal values.\n\n    r.eq(a, b, c).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.floor, b"r.floor(number) -> number\nnumber.floor() -> number\n\nRounds the given value down, returning the largest integer value less than or equal to the given value (the value's floor).\n\n*Example* Return the floor of 12.345.\n\n    > r.floor(12.345).run(conn)\n    \n    12.0\n\nThe `floor` command can also be chained after an expression.\n\n*Example* Return the floor of -12.345.\n\n    > r.expr(-12.345).floor().run(conn)\n    \n    -13.0\n\n*Example* Return Iron Man's weight, rounded down with `floor`.\n\n    r.table('superheroes').get('ironman')['weight'].floor().run(conn)\n"),
	(rethinkdb.ast.RqlQuery.__ge__, b"value.ge(value[, value, ...]) -> bool\nvalue >= value -> bool\n\nCompare values, testing if the left-hand value is greater or equal to than the right-hand.\n\n*Example* Test if a player has scored 10 points or more.\n\n    r.table('players').get(1)['score'].ge(10).run(conn)\n    # alternative syntax\n    (r.table('players').get(1)['score'] >= 10).run(conn)\n\n*Example* Test if variables are ordered from lowest to highest.\n\n    a = 10\n    b = 20\n    c = 15\n    r.ge(a, b, c).run(conn)\n\nThis is the equivalent of the following:\n\n    r.ge(a, b).and(r.ge(b, c)).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.ge, b"value.ge(value[, value, ...]) -> bool\nvalue >= value -> bool\n\nCompare values, testing if the left-hand value is greater or equal to than the right-hand.\n\n*Example* Test if a player has scored 10 points or more.\n\n    r.table('players').get(1)['score'].ge(10).run(conn)\n    # alternative syntax\n    (r.table('players').get(1)['score'] >= 10).run(conn)\n\n*Example* Test if variables are ordered from lowest to highest.\n\n    a = 10\n    b = 20\n    c = 15\n    r.ge(a, b, c).run(conn)\n\nThis is the equivalent of the following:\n\n    r.ge(a, b).and(r.ge(b, c)).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.__gt__, b"value.gt(value[, value, ...]) -> bool\nvalue > value -> bool\n\nCompare values, testing if the left-hand value is greater than the right-hand.\n\n*Example* Test if a player has scored more than 10 points.\n\n    r.table('players').get(1)['score'].gt(10).run(conn)\n    # alternative syntax\n    (r.table('players').get(1)['score'] > 10).run(conn)\n\n*Example* Test if variables are ordered from lowest to highest, with no values being equal to one another.\n\n    a = 10\n    b = 20\n    c = 15\n    r.gt(a, b, c).run(conn)\n\nThis is the equivalent of the following:\n\n    r.gt(a, b).and(r.gt(b, c)).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.gt, b"value.gt(value[, value, ...]) -> bool\nvalue > value -> bool\n\nCompare values, testing if the left-hand value is greater than the right-hand.\n\n*Example* Test if a player has scored more than 10 points.\n\n    r.table('players').get(1)['score'].gt(10).run(conn)\n    # alternative syntax\n    (r.table('players').get(1)['score'] > 10).run(conn)\n\n*Example* Test if variables are ordered from lowest to highest, with no values being equal to one another.\n\n    a = 10\n    b = 20\n    c = 15\n    r.gt(a, b, c).run(conn)\n\nThis is the equivalent of the following:\n\n    r.gt(a, b).and(r.gt(b, c)).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.__le__, b"value.le(value[, value, ...]) -> bool\nvalue <= value -> bool\n\nCompare values, testing if the left-hand value is less than or equal to the right-hand.\n\n*Example* Test if a player has scored 10 points or less.\n\n    r.table('players').get(1)['score'].le(10).run(conn)\n    # alternative syntax\n    (r.table('players').get(1)['score'] <= 10).run(conn)\n\n*Example* Test if variables are ordered from highest to lowest.\n\n    a = 20\n    b = 10\n    c = 15\n    r.le(a, b, c).run(conn)\n\nThis is the equivalent of the following:\n\n    r.le(a, b).and(r.le(b, c)).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.le, b"value.le(value[, value, ...]) -> bool\nvalue <= value -> bool\n\nCompare values, testing if the left-hand value is less than or equal to the right-hand.\n\n*Example* Test if a player has scored 10 points or less.\n\n    r.table('players').get(1)['score'].le(10).run(conn)\n    # alternative syntax\n    (r.table('players').get(1)['score'] <= 10).run(conn)\n\n*Example* Test if variables are ordered from highest to lowest.\n\n    a = 20\n    b = 10\n    c = 15\n    r.le(a, b, c).run(conn)\n\nThis is the equivalent of the following:\n\n    r.le(a, b).and(r.le(b, c)).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.__lt__, b"value.lt(value[, value, ...]) -> bool\nvalue < value -> bool\n\nCompare values, testing if the left-hand value is less than the right-hand.\n\n*Example* Test if a player has scored less than 10 points.\n\n    r.table('players').get(1)['score'].lt(10).run(conn)\n    # alternative syntax\n    (r.table('players').get(1)['score'] < 10).run(conn)\n\n*Example* Test if variables are ordered from highest to lowest, with no values being equal to one another.\n\n    a = 20\n    b = 10\n    c = 15\n    r.lt(a, b, c).run(conn)\n\nThis is the equivalent of the following:\n\n    r.lt(a, b).and(r.lt(b, c)).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.lt, b"value.lt(value[, value, ...]) -> bool\nvalue < value -> bool\n\nCompare values, testing if the left-hand value is less than the right-hand.\n\n*Example* Test if a player has scored less than 10 points.\n\n    r.table('players').get(1)['score'].lt(10).run(conn)\n    # alternative syntax\n    (r.table('players').get(1)['score'] < 10).run(conn)\n\n*Example* Test if variables are ordered from highest to lowest, with no values being equal to one another.\n\n    a = 20\n    b = 10\n    c = 15\n    r.lt(a, b, c).run(conn)\n\nThis is the equivalent of the following:\n\n    r.lt(a, b).and(r.lt(b, c)).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.__mod__, b"number % number -> number\n\nFind the remainder when dividing two numbers.\n\n*Example* It's as easy as 2 % 2 = 0.\n\n    (r.expr(2) % 2).run(conn)\n\n`\n"),
	(rethinkdb.mod, b"number % number -> number\n\nFind the remainder when dividing two numbers.\n\n*Example* It's as easy as 2 % 2 = 0.\n\n    (r.expr(2) % 2).run(conn)\n\n`\n"),
	(rethinkdb.ast.RqlQuery.__mul__, b'number * number -> number\narray * number -> array\nnumber.mul(number[, number, ...]) -> number\narray.mul(number[, number, ...]) -> array\n\nMultiply two numbers, or make a periodic array.\n\n*Example* It\'s as easy as 2 * 2 = 4.\n\n    (r.expr(2) * 2).run(conn)\n\n*Example* Arrays can be multiplied by numbers as well.\n\n    (r.expr(["This", "is", "the", "song", "that", "never", "ends."]) * 100).run(conn)\n\n'),
	(rethinkdb.mul, b'number * number -> number\narray * number -> array\nnumber.mul(number[, number, ...]) -> number\narray.mul(number[, number, ...]) -> array\n\nMultiply two numbers, or make a periodic array.\n\n*Example* It\'s as easy as 2 * 2 = 4.\n\n    (r.expr(2) * 2).run(conn)\n\n*Example* Arrays can be multiplied by numbers as well.\n\n    (r.expr(["This", "is", "the", "song", "that", "never", "ends."]) * 100).run(conn)\n\n'),
	(rethinkdb.ast.RqlQuery.__ne__, b"value.ne(value[, value, ...]) -> bool\nvalue != value -> bool\n\nTest if two or more values are not equal.\n\n*Example* See if a user's `role` field is not set to `administrator`. \n\n    r.table('users').get(1)['role'].ne('administrator').run(conn)\n    # alternative syntax\n    (r.table('users').get(1)['role'] != 'administrator').run(conn)\n\n*Example* See if three variables do not contain equal values.\n\n    r.ne(a, b, c).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.ne, b"value.ne(value[, value, ...]) -> bool\nvalue != value -> bool\n\nTest if two or more values are not equal.\n\n*Example* See if a user's `role` field is not set to `administrator`. \n\n    r.table('users').get(1)['role'].ne('administrator').run(conn)\n    # alternative syntax\n    (r.table('users').get(1)['role'] != 'administrator').run(conn)\n\n*Example* See if three variables do not contain equal values.\n\n    r.ne(a, b, c).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.__invert__, b'bool.not_() -> bool\nnot_(bool) -> bool\n(~bool) -> bool\n\nCompute the logical inverse (not) of an expression.\n\n`not_` can be called either via method chaining, immediately after an expression that evaluates as a boolean value, or by passing the expression as a parameter to `not_`.  All values that are not `False` or `None` will be converted to `True`.\n\nYou may also use `~` as a shorthand operator.\n\n*Example* Not true is false.\n\n    r.not_(True).run(conn)\n    r.expr(True).not_().run(conn)\n    (~r.expr(True)).run(conn)\n\nThese evaluate to `false`.\n\nNote that when using `~` the expression is wrapped in parentheses. Without this, Python will evaluate `r.expr(True)` *first* rather than using the ReQL operator and return an incorrect value. (`~True` evaluates to &minus;2 in Python.)\n\n*Example* Return all the users that do not have a "flag" field.\n\n    r.table(\'users\').filter(\n        lambda users: (~users.has_fields(\'flag\'))\n    ).run(conn)\n\n*Example* As above, but prefix-style.\n\n    r.table(\'users\').filter(\n        lambda users: r.not_(users.has_fields(\'flag\'))\n    ).run(conn)\n'),
	(rethinkdb.ast.RqlQuery.not_, b'bool.not_() -> bool\nnot_(bool) -> bool\n(~bool) -> bool\n\nCompute the logical inverse (not) of an expression.\n\n`not_` can be called either via method chaining, immediately after an expression that evaluates as a boolean value, or by passing the expression as a parameter to `not_`.  All values that are not `False` or `None` will be converted to `True`.\n\nYou may also use `~` as a shorthand operator.\n\n*Example* Not true is false.\n\n    r.not_(True).run(conn)\n    r.expr(True).not_().run(conn)\n    (~r.expr(True)).run(conn)\n\nThese evaluate to `false`.\n\nNote that when using `~` the expression is wrapped in parentheses. Without this, Python will evaluate `r.expr(True)` *first* rather than using the ReQL operator and return an incorrect value. (`~True` evaluates to &minus;2 in Python.)\n\n*Example* Return all the users that do not have a "flag" field.\n\n    r.table(\'users\').filter(\n        lambda users: (~users.has_fields(\'flag\'))\n    ).run(conn)\n\n*Example* As above, but prefix-style.\n\n    r.table(\'users\').filter(\n        lambda users: r.not_(users.has_fields(\'flag\'))\n    ).run(conn)\n'),
	(rethinkdb.not_, b'bool.not_() -> bool\nnot_(bool) -> bool\n(~bool) -> bool\n\nCompute the logical inverse (not) of an expression.\n\n`not_` can be called either via method chaining, immediately after an expression that evaluates as a boolean value, or by passing the expression as a parameter to `not_`.  All values that are not `False` or `None` will be converted to `True`.\n\nYou may also use `~` as a shorthand operator.\n\n*Example* Not true is false.\n\n    r.not_(True).run(conn)\n    r.expr(True).not_().run(conn)\n    (~r.expr(True)).run(conn)\n\nThese evaluate to `false`.\n\nNote that when using `~` the expression is wrapped in parentheses. Without this, Python will evaluate `r.expr(True)` *first* rather than using the ReQL operator and return an incorrect value. (`~True` evaluates to &minus;2 in Python.)\n\n*Example* Return all the users that do not have a "flag" field.\n\n    r.table(\'users\').filter(\n        lambda users: (~users.has_fields(\'flag\'))\n    ).run(conn)\n\n*Example* As above, but prefix-style.\n\n    r.table(\'users\').filter(\n        lambda users: r.not_(users.has_fields(\'flag\'))\n    ).run(conn)\n'),
	(rethinkdb.ast.RqlQuery.__or__, b'bool | bool -> bool\nbool.or_([bool, bool, ...]) -> bool\nr.or_([bool, bool, ...]) -> bool\n\nCompute the logical "or" of one or more values.\n\nThe `or_` command can be used as an infix operator after its first argument (`r.expr(True).or_(False)`) or given all of its arguments as parameters (`r.or_(True, False)`). The standard Python or operator, `|`, may also be used with ReQL.\n\nCalling `or_` with zero arguments will return `False`.\n\n*Example* Return whether either `a` or `b` evaluate to true.\n\n    > a = True\n    > b = False\n    > (r.expr(a) | b).run(conn)\n    \n    True\n\n*Example* Return whether any of `x`, `y` or `z` evaluate to true.\n\n    > x = False\n    > y = False\n    > z = False\n    > r.or_(x, y, z).run(conn)\n    \n    False\n\n__Note:__ When using `or` inside a `filter` predicate to test the values of fields that may not exist on the documents being tested, you should use the `default` command with those fields so they explicitly return `False`.\n\n    r.table(\'posts\').filter(lambda post:\n        post[\'category\'].default(\'foo\').eq(\'article\').or(\n            post[\'genre\'].default(\'foo\').eq(\'mystery\'))\n    ).run(conn)\n'),
	(rethinkdb.or_, b'bool | bool -> bool\nbool.or_([bool, bool, ...]) -> bool\nr.or_([bool, bool, ...]) -> bool\n\nCompute the logical "or" of one or more values.\n\nThe `or_` command can be used as an infix operator after its first argument (`r.expr(True).or_(False)`) or given all of its arguments as parameters (`r.or_(True, False)`). The standard Python or operator, `|`, may also be used with ReQL.\n\nCalling `or_` with zero arguments will return `False`.\n\n*Example* Return whether either `a` or `b` evaluate to true.\n\n    > a = True\n    > b = False\n    > (r.expr(a) | b).run(conn)\n    \n    True\n\n*Example* Return whether any of `x`, `y` or `z` evaluate to true.\n\n    > x = False\n    > y = False\n    > z = False\n    > r.or_(x, y, z).run(conn)\n    \n    False\n\n__Note:__ When using `or` inside a `filter` predicate to test the values of fields that may not exist on the documents being tested, you should use the `default` command with those fields so they explicitly return `False`.\n\n    r.table(\'posts\').filter(lambda post:\n        post[\'category\'].default(\'foo\').eq(\'article\').or(\n            post[\'genre\'].default(\'foo\').eq(\'mystery\'))\n    ).run(conn)\n'),
	(rethinkdb.random, b"r.random() -> number\nr.random(number[, number], float=True) -> number\nr.random(integer[, integer]) -> integer\n\nGenerate a random number between given (or implied) bounds. `random` takes zero, one or two arguments.\n\n- With __zero__ arguments, the result will be a floating-point number in the range `[0,1)` (from 0 up to but not including 1).\n- With __one__ argument _x,_ the result will be in the range `[0,x)`, and will be integer unless `float=True` is given as an option. Specifying a floating point number without the `float` option will raise an error.\n- With __two__ arguments _x_ and _y,_ the result will be in the range `[x,y)`, and will be integer unless `float=True` is given as an option.  If _x_ and _y_ are equal an error will occur, unless the floating-point option has been specified, in which case _x_ will be returned. Specifying a floating point number without the `float` option will raise an error.\n\nNote: The last argument given will always be the 'open' side of the range, but when\ngenerating a floating-point number, the 'open' side may be less than the 'closed' side.\n\n*Example* Generate a random number in the range `[0,1)`\n\n    r.random().run(conn)\n\n*Example* Generate a random integer in the range `[0,100)`\n\n    r.random(100).run(conn)\n    r.random(0, 100).run(conn)\n\n*Example* Generate a random number in the range `(-2.24,1.59]`\n\n    r.random(1.59, -2.24, float=True).run(conn)\n\n"),
	(rethinkdb.ast.RqlQuery.round, b"r.round(number) -> number\nnumber.round() -> number\n\nRounds the given value to the nearest whole integer.\n\nFor example, values of 1.0 up to but not including 1.5 will return 1.0, similar to floor; values of 1.5 up to 2.0 will return 2.0, similar to ceil.\n\n*Example* Round 12.345 to the nearest integer.\n\n    > r.round(12.345).run(conn)\n    \n    12.0\n\nThe `round` command can also be chained after an expression.\n\n*Example* Round -12.345 to the nearest integer.\n\n    > r.expr(-12.345).round().run(conn)\n    \n    -12.0\n\n*Example* Return Iron Man's weight, rounded to the nearest integer.\n\n    r.table('superheroes').get('ironman')['weight'].round().run(conn)\n"),
	(rethinkdb.ast.RqlQuery.__sub__, b"number - number -> number\ntime - number -> time\ntime - time -> number\nnumber.sub(number[, number, ...]) -> number\ntime.sub(number[, number, ...]) -> time\ntime.sub(time) -> number\n\nSubtract two numbers.\n\n*Example* It's as easy as 2 - 2 = 0.\n\n    (r.expr(2) - 2).run(conn)\n\n*Example* Create a date one year ago today.\n\n    r.now() - 365*24*60*60\n\n*Example* Retrieve how many seconds elapsed between today and `date`.\n\n    r.now() - date\n\n"),
	(rethinkdb.sub, b"number - number -> number\ntime - number -> time\ntime - time -> number\nnumber.sub(number[, number, ...]) -> number\ntime.sub(number[, number, ...]) -> time\ntime.sub(time) -> number\n\nSubtract two numbers.\n\n*Example* It's as easy as 2 - 2 = 0.\n\n    (r.expr(2) - 2).run(conn)\n\n*Example* Create a date one year ago today.\n\n    r.now() - 365*24*60*60\n\n*Example* Retrieve how many seconds elapsed between today and `date`.\n\n    r.now() - date\n\n"),
	(rethinkdb.ast.Table.between, b'table.between(lower_key, upper_key[, options]) -> table_slice\ntable_slice.between(lower_key, upper_key[, options]) -> table_slice\n\nGet all documents between two keys. Accepts three optional arguments: `index`, `left_bound`, and `right_bound`. If `index` is set to the name of a secondary index, `between` will return all documents where that index\'s value is in the specified range (it uses the primary key by default). `left_bound` or `right_bound` may be set to `open` or `closed` to indicate whether or not to include that endpoint of the range (by default, `left_bound` is closed and `right_bound` is open).\n\nYou may also use the special constants `r.minval` and `r.maxval` for boundaries, which represent "less than any index key" and "more than any index key" respectively. For instance, if you use `r.minval` as the lower key, then `between` will return all documents whose primary keys (or indexes) are less than the specified upper key.\n\nIf you use arrays as indexes (compound indexes), they will be sorted using lexicographical order. Take the following range as an example:\n\n\t[[1, "c"] ... [5, "e"]]\n\nThis range includes all compound keys:\n\n* whose first item is 1 and second item is equal or greater than "c";\n* whose first item is between 1 and 5, *regardless of the value of the second item*;\n* whose first item is 5 and second item is less than or equal to "e".\n\n*Example* Find all users with primary key >= 10 and < 20 (a normal half-open interval).\n\n    r.table(\'marvel\').between(10, 20).run(conn)\n\n*Example* Find all users with primary key >= 10 and <= 20 (an interval closed on both sides).\n\n    r.table(\'marvel\').between(10, 20, right_bound=\'closed\').run(conn)\n\n*Example* Find all users with primary key < 20.\n\n    r.table(\'marvel\').between(r.minval, 20).run(conn)\n\n*Example* Find all users with primary key > 10.\n\n    r.table(\'marvel\').between(10, r.maxval, left_bound=\'open\').run(conn)\n\n*Example* Between can be used on secondary indexes too. Just pass an optional index argument giving the secondary index to query.\n\n    r.table(\'dc\').between(\'dark_knight\', \'man_of_steel\', index=\'code_name\').run(conn)\n\n*Example* Get all users whose full name is between "John Smith" and "Wade Welles."\n\n    r.table("users").between(["Smith", "John"], ["Welles", "Wade"],\n        index="full_name").run(conn)\n\n*Example* Get the top 10 ranked teams in order.\n\n    r.table("teams").order_by(index="rank").between(1, 11).run(conn)\n\n__Note:__ When `between` is chained after [order_by](http://rethinkdb.com/api/python/order_by), both commands must use the same index; `between` will default to the index `order_by` is using, so in this example `"rank"` is automatically being used by `between`. Trying to specify another index will result in a `ReqlRuntimeError`.\n\n*Example* Subscribe to a [changefeed](http://rethinkdb.com/docs/changefeeds/python) of teams ranked in the top 10.\n\n    changes = r.table("teams").between(1, 11, index="rank").changes().run(conn)\n\n'),
	(rethinkdb.db, b"r.db(db_name) -> db\n\nReference a database.\n\nThe `db` command is optional. If it is not present in a query, the query will run against the database specified in the `db` argument given to [run](http://rethinkdb.com/api/python/run) if one was specified. Otherwise, the query will run against the default database for the connection, specified in the `db` argument to [connect](http://rethinkdb.com/api/python/connect).\n\n*Example* Explicitly specify a database for a query.\n\n    r.db('heroes').table('marvel').run(conn)\n\n"),
	(rethinkdb.ast.RqlQuery.filter, b'selection.filter(predicate_function[, default=False]) -> selection\nstream.filter(predicate_function[, default=False]) -> stream\narray.filter(predicate_function[, default=False]) -> array\n\nReturn all the elements in a sequence for which the given predicate is true. The return value of `filter` will be the same as the input (sequence, stream, or array). Documents can be filtered in a variety of ways&mdash;ranges, nested values, boolean conditions, and the results of anonymous functions.\n\nBy default, `filter` will silently skip documents with missing fields: if the predicate tries to access a field that doesn\'t exist (for instance, the predicate `{\'age\': 30}` applied to a document with no `age` field), that document will not be returned in the result set, and no error will be generated. This behavior can be changed with the `default` optional argument.\n\n* If `default` is set to `True`, documents with missing fields will be returned rather than skipped.\n* If `default` is set to `r.error()`, an `ReqlRuntimeError` will be thrown when a document with a missing field is tested.\n* If `default` is set to `False` (the default), documents with missing fields will be skipped.\n\n*Example* Get all users who are 30 years old.\n\n    r.table(\'users\').filter({\'age\': 30}).run(conn)\n\nThe predicate `{\'age\': 30}` selects documents in the `users` table with an `age` field whose value is `30`. Documents with an `age` field set to any other value *or* with no `age` field present are skipped.\n\n<!-- stop -->\n\nWhile the `{\'field\': value}` style of predicate is useful for exact matches, a more general way to write a predicate is to use the [row](http://rethinkdb.com/api/python/row) command with a comparison operator such as [eq](http://rethinkdb.com/api/python/eq) (`==`) or [gt](http://rethinkdb.com/api/python/gt) (`>`), or to use a lambda function that returns `True` or `False`.\n\n    r.table(\'users\').filter(r.row["age"] == 30).run(conn)\n\nIn this case, the predicate `r.row["age"] == 30` returns `True` if the field `age` is equal to 30. You can write this predicate as a lambda function instead:\n\n    r.table(\'users\').filter(lambda user:\n        user["age"] == 30\n    ).run(conn)\n\nPredicates to `filter` are evaluated on the server, and must use ReQL expressions. Some Python comparison operators are overloaded by the RethinkDB driver and will be translated to ReQL, such as `==`, `<`/`>` and `|`/`&` (note the single character form, rather than `||`/`&&`).\n\nAlso, predicates must evaluate document fields. They cannot evaluate [secondary indexes](http://rethinkdb.com/docs/secondary-indexes/).\n\n*Example* Get all users who are more than 18 years old.\n\n    r.table("users").filter(r.row["age"] > 18).run(conn)\n\n*Example* Get all users who are less than 18 years old and more than 13 years old.\n\n    r.table("users").filter((r.row["age"] < 18) & (r.row["age"] > 13)).run(conn)\n\n*Example* Get all users who are more than 18 years old or have their parental consent.\n\n    r.table("users").filter(\n        (r.row["age"] >= 18) | (r.row["hasParentalConsent"])).run(conn)\n\n*Example* Retrieve all users who subscribed between January 1st, 2012\n(included) and January 1st, 2013 (excluded).\n\n    r.table("users").filter(\n        lambda user: user["subscription_date"].during(\n            r.time(2012, 1, 1, \'Z\'), r.time(2013, 1, 1, \'Z\'))\n    ).run(conn)\n\n*Example* Retrieve all users who have a gmail account (whose field `email` ends with `@gmail.com`).\n\n    r.table("users").filter(\n        lambda user: user["email"].match("@gmail.com$")\n    ).run(conn)\n\n*Example* Filter based on the presence of a value in an array.\n\nGiven this schema for the `users` table:\n\n    {\n        "name": <type \'str\'>\n        "places_visited": [<type \'str\'>]\n    }\n\nRetrieve all users whose field `places_visited` contains `France`.\n\n    r.table("users").filter(lambda user:\n        user["places_visited"].contains("France")\n    ).run(conn)\n\n*Example* Filter based on nested fields.\n\nGiven this schema for the `users` table:\n\n    {\n        "id": <type \'str\'>\n        "name": {\n            "first": <type \'str\'>,\n            "middle": <type \'str\'>,\n            "last": <type \'str\'>\n        }\n    }\n\nRetrieve all users named "William Adama" (first name "William", last name\n"Adama"), with any middle name.\n\n    r.table("users").filter({\n        "name": {\n            "first": "William",\n            "last": "Adama"\n        }\n    }).run(conn)\n\nIf you want an exact match for a field that is an object, you will have to use `r.literal`.\n\nRetrieve all users named "William Adama" (first name "William", last name\n"Adama"), and who do not have a middle name.\n\n    r.table("users").filter(r.literal({\n        "name": {\n            "first": "William",\n            "last": "Adama"\n        }\n    })).run(conn)\n\nYou may rewrite these with lambda functions.\n\n    r.table("users").filter(\n        lambda user:\n        (user["name"]["first"] == "William")\n            & (user["name"]["last"] == "Adama")\n    ).run(conn)\n\n    r.table("users").filter(lambda user:\n        user["name"] == {\n            "first": "William",\n            "last": "Adama"\n        }\n    ).run(conn)\n\nBy default, documents missing fields tested by the `filter` predicate are skipped. In the previous examples, users without an `age` field are not returned. By passing the optional `default` argument to `filter`, you can change this behavior.\n\n*Example* Get all users less than 18 years old or whose `age` field is missing.\n\n    r.table("users").filter(r.row["age"] < 18, default=True).run(conn)\n\n*Example* Get all users more than 18 years old. Throw an error if a\ndocument is missing the field `age`.\n\n    r.table("users").filter(r.row["age"] > 18, default=r.error()).run(conn)\n\n*Example* Get all users who have given their phone number (all the documents whose field `phone_number` exists and is not `None`).\n\n    r.table(\'users\').filter(\n        lambda user: user.has_fields(\'phone_number\')\n    ).run(conn)\n\n*Example* Get all users with an "editor" role or an "admin" privilege.\n\n    r.table(\'users\').filter(\n        lambda user: (user[\'role\'] == \'editor\').default(False) |\n            (user[\'privilege\'] == \'admin\').default(False)\n    ).run(conn)\n\nInstead of using the `default` optional argument to `filter`, we have to use default values on the fields within the `or` clause. Why? If the field on the left side of the `or` clause is missing from a document&mdash;in this case, if the user doesn\'t have a `role` field&mdash;the predicate will generate an error, and will return `False` (or the value the `default` argument is set to) without evaluating the right side of the `or`. By using `.default(False)` on the fields, each side of the `or` will evaluate to either the field\'s value or `False` if the field doesn\'t exist.\n'),
	(rethinkdb.ast.Table.get, b"table.get(key) -> singleRowSelection\n\nGet a document by primary key.\n\nIf no document exists with that primary key, `get` will return `None`.\n\n*Example* Find a document by UUID.\n\n    r.table('posts').get('a9849eef-7176-4411-935b-79a6e3c56a74').run(conn)\n\n*Example* Find a document and merge another document with it.\n\n    r.table('heroes').get(3).merge(\n        { 'powers': ['invisibility', 'speed'] }\n    ).run(conn)\n\n_*Example* Subscribe to a document's [changefeed](http://rethinkdb.com/docs/changefeeds/python).\n\n    changes = r.table('heroes').get(3).changes().run(conn)\n"),
	(rethinkdb.ast.Table.get_all, b"table.get_all([key1, key2...], [, index='id']) -> selection\n\nGet all documents where the given value matches the value of the requested index.\n\n*Example* Secondary index keys are not guaranteed to be unique so we cannot query via [get](http://rethinkdb.com/api/python/get/) when using a secondary index.\n\n    r.table('marvel').get_all('man_of_steel', index='code_name').run(conn)\n\n*Example* Without an index argument, we default to the primary index. While `get` will either return the document or `None` when no document with such a primary key value exists, this will return either a one or zero length stream.\n\n    r.table('dc').get_all('superman').run(conn)\n\n*Example* You can get multiple documents in a single call to `get_all`.\n\n    r.table('dc').get_all('superman', 'ant man').run(conn)\n\n*Example* You can use [args](http://rethinkdb.com/api/python/args/) with `get_all` to retrieve multiple documents whose keys are in a list. This uses `get_all` to get a list of female superheroes, coerces that to an array, and then gets a list of villains who have those superheroes as enemies.\n\n    r.do(\n        r.table('heroes').get_all('f', index='gender')['id'].coerce_to('array'), \n        lamdba heroines: r.table('villains').get_all(r.args(heroines))\n    ).run(conn)\n\nCalling `get_all` with zero arguments&mdash;which could happen in this example if the `heroines` list had no elements&mdash;will return nothing, i.e., a zero length stream.\n\nSecondary indexes can be used in extremely powerful ways with `get_all` and other commands; read the full article on [secondary indexes](http://rethinkdb.com/docs/secondary-indexes) for examples using boolean operations, `contains` and more.\n"),
	(rethinkdb.ast.DB.table, b"db.table(name[, read_mode='single', identifier_format='name']) -> table\n\nReturn all documents in a table. Other commands may be chained after `table` to return a subset of documents (such as [get](http://rethinkdb.com/api/python/get/) and [filter](http://rethinkdb.com/api/python/filter/)) or perform further processing.\n\n*Example* Return all documents in the table 'marvel' of the default database.\n\n    r.table('marvel').run(conn)\n\n*Example* Return all documents in the table 'marvel' of the database 'heroes'.\n\n    r.db('heroes').table('marvel').run(conn)\n\nThere are two optional arguments.\n\n* `read_mode`: One of three possible values affecting the consistency guarantee for the table read:\n    * `single` returns values that are in memory (but not necessarily written to disk) on the primary replica. This is the default.\n    * `majority` will only return values that are safely committed on disk on a majority of replicas. This requires sending a message to every replica on each read, so it is the slowest but most consistent.\n    * `outdated` will return values that are in memory on an arbitrarily-selected replica. This is the fastest but least consistent.\n* `identifier_format`: possible values are `name` and `uuid`, with a default of `name`. If set to `uuid`, then [system tables](http://rethinkdb.com/docs/system-tables/) will refer to servers, databases and tables by UUID rather than name. (This only has an effect when used with system tables.)\n\n*Example* Allow potentially out-of-date data in exchange for faster reads.\n\n    r.db('heroes').table('marvel', read_mode='outdated').run(conn)\n"),
	(rethinkdb.ast.RqlQuery.downcase, b'string.downcase() -> string\n\nLowercases a string.\n\n*Example*\n\n    > r.expr("Sentence about LaTeX.").downcase().run(conn)\n    "sentence about latex."\n\n__Note:__ `upcase` and `downcase` only affect ASCII characters.\n'),
	(rethinkdb.ast.RqlQuery.match, b'string.match(regexp) -> None/object\n\nMatches against a regular expression. If there is a match, returns an object with the fields:\n\n- `str`: The matched string\n- `start`: The matched string\'s start\n- `end`: The matched string\'s end\n- `groups`: The capture groups defined with parentheses\n\nIf no match is found, returns `None`.\n\n<!-- break -->\n\nAccepts RE2 syntax\n([https://code.google.com/p/re2/wiki/Syntax](https://code.google.com/p/re2/wiki/Syntax)).\nYou can enable case-insensitive matching by prefixing the regular expression with\n`(?i)`. See the linked RE2 documentation for more flags.\n\nThe `match` command does not support backreferences.\n\n*Example* Get all users whose name starts with "A". Because `None` evaluates to `false` in\n[filter](http://rethinkdb.com/api/python/filter/), you can just use the result of `match` for the predicate.\n\n    r.table(\'users\').filter(lambda doc:\n        doc[\'name\'].match("^A")\n    ).run(conn)\n\n*Example* Get all users whose name ends with "n".\n\n    r.table(\'users\').filter(lambda doc:\n        doc[\'name\'].match("n$")\n    ).run(conn)\n\n*Example* Get all users whose name has "li" in it\n\n    r.table(\'users\').filter(lambda doc:\n        doc[\'name\'].match("li")\n    ).run(conn)\n\n*Example* Get all users whose name is "John" with a case-insensitive search.\n\n    r.table(\'users\').filter(lambda doc:\n        doc[\'name\'].match("(?i)^john$")\n    ).run(conn)\n\n*Example* Get all users whose name is composed of only characters between "a" and "z".\n\n    r.table(\'users\').filter(lambda doc:\n        doc[\'name\'].match("(?i)^[a-z]+$")\n    ).run(conn)\n\n*Example* Get all users where the zipcode is a string of 5 digits.\n\n    r.table(\'users\').filter(lambda doc:\n        doc[\'zipcode\'].match("\\d{5}")\n    ).run(conn)\n\n*Example* Retrieve the domain of a basic email\n\n    r.expr("name@domain.com").match(".*@(.*)").run(conn)\n\nResult:\n\n    {\n        "start": 0,\n        "end": 20,\n        "str": "name@domain.com",\n        "groups":[\n            {\n                "end": 17,\n                "start": 7,\n                "str": "domain.com"\n            }\n        ]\n    }\n\nYou can then retrieve only the domain with the [\\[\\]](http://rethinkdb.com/api/python/get_field) selector.\n\n    r.expr("name@domain.com").match(".*@(.*)")["groups"][0]["str"].run(conn)\n\nReturns `\'domain.com\'`\n\n*Example* Fail to parse out the domain and returns `None`.\n\n    r.expr("name[at]domain.com").match(".*@(.*)").run(conn)\n'),
	(rethinkdb.ast.RqlQuery.split, b'string.split([separator, [max_splits]]) -> array\n\nSplits a string into substrings.  Splits on whitespace when called\nwith no arguments.  When called with a separator, splits on that\nseparator.  When called with a separator and a maximum number of\nsplits, splits on that separator at most `max_splits` times.  (Can be\ncalled with `None` as the separator if you want to split on whitespace\nwhile still specifying `max_splits`.)\n\nMimics the behavior of Python\'s `string.split` in edge cases, except\nfor splitting on the empty string, which instead produces an array of\nsingle-character strings.\n\n*Example* Split on whitespace.\n\n    > r.expr("foo  bar bax").split().run(conn)\n    ["foo", "bar", "bax"]\n\n*Example* Split the entries in a CSV file.\n\n    > r.expr("12,37,,22,").split(",").run(conn)\n    ["12", "37", "", "22", ""]\n\n*Example* Split a string into characters.\n\n    > r.expr("mlucy").split("").run(conn)\n    ["m", "l", "u", "c", "y"]\n\n*Example* Split the entries in a CSV file, but only at most 3\ntimes.\n\n    > r.expr("12,37,,22,").split(",", 3).run(conn)\n    ["12", "37", "", "22,"]\n\n*Example* Split on whitespace at most once (i.e. get the first word).\n\n    > r.expr("foo  bar bax").split(None, 1).run(conn)\n    ["foo", "bar bax"]\n'),
	(rethinkdb.ast.RqlQuery.upcase, b'string.upcase() -> string\n\nUppercases a string.\n\n*Example*\n\n    > r.expr("Sentence about LaTeX.").upcase().run(conn)\n    "SENTENCE ABOUT LATEX."\n\n__Note:__ `upcase` and `downcase` only affect ASCII characters.\n'),
	(rethinkdb.ast.RqlQuery.concat_map, b'stream.concat_map(function) -> stream\narray.concat_map(function) -> array\n\nConcatenate one or more elements into a single sequence using a mapping function.\n\n`concat_map` works in a similar fashion to [map](http://rethinkdb.com/api/python/map/), applying the given function to each element in a sequence, but it will always return a single sequence. If the mapping function returns a sequence, `map` would produce a sequence of sequences:\n\n    r.expr([1, 2, 3]).map(lambda x: [x, x.mul(2)]).run(conn)\n\nResult:\n\n    [[1, 2], [2, 4], [3, 6]]\n\nWhereas `concat_map` with the same mapping function would merge those sequences into one:\n\n    r.expr([1, 2, 3]).concat_map(lambda x: [x, x.mul(2)]).run(conn)\n\nResult:\n\n    [1, 2, 2, 4, 3, 6]\n\nThe return value, array or stream, will be the same type as the input.\n\n*Example* Construct a sequence of all monsters defeated by Marvel heroes. The field "defeatedMonsters" is an array of one or more monster names.\n\n    r.table(\'marvel\').concat_map(lambda hero: hero[\'defeatedMonsters\']).run(conn)\n\n*Example* Simulate an [eq_join](http://rethinkdb.com/api/python/eq_join/) using `concat_map`. (This is how ReQL joins are implemented internally.)\n\n    r.table(\'posts\').concat_map(\n        lambda post: r.table(\'comments\').get_all(\n            post[\'id\'], index=\'post_id\'\n        ).map(\n            lambda comment: { \'left\': post, \'right\': comment}\n        )\n    ).run(conn)\n'),
	(rethinkdb.ast.RqlQuery.is_empty, b"sequence.is_empty() -> bool\n\nTest if a sequence is empty.\n\n*Example* Are there any documents in the marvel table?\n\n    r.table('marvel').is_empty().run(conn)\n\n"),
	(rethinkdb.ast.RqlQuery.limit, b"sequence.limit(n) -> stream\narray.limit(n) -> array\n\nEnd the sequence after the given number of elements.\n\n*Example* Only so many can fit in our Pantheon of heroes.\n\n    r.table('marvel').order_by('belovedness').limit(10).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.map, b"sequence1.map([sequence2, ...], function) -> stream\narray1.map([array2, ...], function) -> array\nr.map(sequence1[, sequence2, ...], function) -> stream\nr.map(array1[, array2, ...], function) -> array\n\nTransform each element of one or more sequences by applying a mapping function to them. If `map` is run with two or more sequences, it will iterate for as many items as there are in the shortest sequence.\n\nNote that `map` can only be applied to sequences, not single values. If you wish to apply a function to a single value/selection (including an array), use the [do](http://rethinkdb.com/api/python/do) command.\n\n*Example* Return the first five squares.\n\n    > r.expr([1, 2, 3, 4, 5]).map(lambda val: (val * val)).run(conn)\n    \n    [1, 4, 9, 16, 25]\n\n*Example* Sum the elements of three sequences.\n\n    > sequence1 = [100, 200, 300, 400]\n    > sequence2 = [10, 20, 30, 40]\n    > sequence3 = [1, 2, 3, 4]\n    > r.map(sequence1, sequence2, sequence3,\n        lambda val1, val2, val3: (val1 + val2 + val3)).run(conn)\n    \n    [111, 222, 333, 444]\n\n*Example* Rename a field when retrieving documents using `map` and [merge](http://rethinkdb.com/api/python/merge/).\n\nThis example renames the field `id` to `user_id` when retrieving documents from the table `users`.\n\n    r.table('users').map(\n        lambda doc: doc.merge({'user_id': doc['id']}).without('id')).run(conn)\n\nNote that in this case, [row](http://rethinkdb.com/api/python/row) may be used as an alternative to writing an anonymous function, as it returns the same value as the function parameter receives:\n\n    r.table('users').map(\n        r.row.merge({'user_id': r.row['id']}).without('id')).run(conn)\n\n*Example* Assign every superhero an archenemy.\n\n    r.table('heroes').map(r.table('villains'),\n        lambda hero, villain: hero.merge({'villain': villain})).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.nth, b"sequence.nth(index) -> object\nselection.nth(index) -> selection&lt;object&gt;\n\nGet the *nth* element of a sequence, counting from zero. If the argument is negative, count from the last element.\n\n*Example* Select the second element in the array.\n\n    r.expr([1,2,3]).nth(1).run(conn)\n    r.expr([1,2,3])[1].run(conn)\n\n*Example* Select the bronze medalist from the competitors.\n\n    r.table('players').order_by(index=r.desc('score')).nth(3).run(conn)\n\n*Example* Select the last place competitor.\n\n    r.table('players').order_by(index=r.desc('score')).nth(-1).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.offsets_of, b"sequence.offsets_of(datum | predicate_function) -> array\n\nGet the indexes of an element in a sequence. If the argument is a predicate, get the indexes of all elements matching it.\n\n*Example* Find the position of the letter 'c'.\n\n    r.expr(['a','b','c']).offsets_of('c').run(conn)\n\n*Example* Find the popularity ranking of invisible heroes.\n\n    r.table('marvel').union(r.table('dc')).order_by('popularity').offsets_of(\n        r.row['superpowers'].contains('invisibility')\n    ).run(conn)\n\n"),
	(rethinkdb.ast.Table.order_by, b'table.order_by([key | function], index=index_name) -> table_slice\nselection.order_by(key | function[, ...]) -> selection<array>\nsequence.order_by(key | function[, ...]) -> array\n\nSort the sequence by document values of the given key(s). To specify\nthe ordering, wrap the attribute with either `r.asc` or `r.desc`\n(defaults to ascending).\n\n__Note:__ RethinkDB uses byte-wise ordering for `orderBy` and does not support Unicode collations; non-ASCII characters will be sorted by UTF-8 codepoint. For more information on RethinkDB\'s sorting order, read the section in [ReQL data types](http://rethinkdb.com/docs/data-types/#sorting-order).\n\nSorting without an index requires the server to hold the sequence in\nmemory, and is limited to 100,000 documents (or the setting of the `arrayLimit` option for [run](http://rethinkdb.com/api/python/run)). Sorting with an index can\nbe done on arbitrarily large tables, or after a [between](http://rethinkdb.com/api/python/between/) command\nusing the same index. This applies to both secondary indexes and the primary key (e.g., `index=\'id\'`).\n\n*Example* Order all the posts using the index `date`.   \n\n    r.table(\'posts\').order_by(index=\'date\').run(conn)\n\n<!-- stop -->\n\nThe index must either be the primary key or have been previously created with [index_create](http://rethinkdb.com/api/python/index_create/).\n\n    r.table(\'posts\').index_create(\'date\').run(conn)\n\nYou can also select a descending ordering:\n\n    r.table(\'posts\').order_by(index=r.desc(\'date\')).run(conn, callback)\n\n*Example* Order a sequence without an index.\n\n    r.table(\'posts\').get(1)[\'comments\'].order_by(\'date\')\n\nYou can also select a descending ordering:\n\n    r.table(\'posts\').get(1)[\'comments\'].order_by(r.desc(\'date\'))\n\nIf you\'re doing ad-hoc analysis and know your table won\'t have more then 100,000\nelements (or you\'ve changed the setting of the `arrayLimit` option for [run](http://rethinkdb.com/api/python/run)) you can run `order_by` without an index:\n\n    r.table(\'small_table\').order_by(\'date\')\n\n*Example* You can efficiently order using multiple fields by using a\n[compound index](http://www.rethinkdb.com/docs/secondary-indexes/python/).\n\nOrder by date and title.\n\n    r.table(\'posts\').order_by(index=\'date_and_title\').run(conn)\n\nThe index must either be the primary key or have been previously created with [index_create](http://rethinkdb.com/api/python/index_create/).\n\n    r.table(\'posts\').index_create(\'date_and_title\', lambda post:\n        [post["date"], post["title"]]).run(conn)\n\n_Note_: You cannot specify multiple orders in a compound index. See [issue #2306](https://github.com/rethinkdb/rethinkdb/issues/2306)\nto track progress.\n\n*Example* If you have a sequence with fewer documents than the `array_limit`, you can order it\nby multiple fields without an index.\n\n    r.table(\'small_table\').order_by(\'date\', r.desc(\'title\'))\n\n*Example* Notice that an index ordering always has highest\nprecedence. The following query orders posts by date, and if multiple\nposts were published on the same date, they will be ordered by title.\n\n    r.table(\'post\').order_by(\'title\', index=\'date\').run(conn)\n*Example* You can use [nested field](http://rethinkdb.com/docs/cookbook/python/#filtering-based-on-nested-fields) syntax to sort on fields from subdocuments. (You can also create indexes on nested fields using this syntax with `index_create`.)\n\n    r.table(\'user\').order_by(lambda user: user[\'group\'][\'id\']).run(conn)\n\n*Example* You can efficiently order data on arbitrary expressions using indexes.\n\n    r.table(\'posts\').order_by(index=\'votes\').run(conn)\n\nThe index must have been previously created with [index_create](http://rethinkdb.com/api/ruby/index_create/).\n\n    r.table(\'posts\').index_create(\'votes\', lambda post:\n        post["upvotes"]-post["downvotes"]\n    ).run(conn)\n\n*Example* If you have a sequence with fewer documents than the `array_limit`, you can order it with an arbitrary function directly.\n\n    r.table(\'small_table\').order_by(lambda doc:\n        doc[\'upvotes\']-doc[\'downvotes\']\n    );\n\nYou can also select a descending ordering:\n\n    r.table(\'small_table\').order_by(r.desc(lambda doc:\n        doc[\'upvotes\']-doc[\'downvotes\']\n    ));\n\n*Example* Ordering after a `between` command can be done as long as the same index is being used.\n\n    r.table("posts").between(r.time(2013, 1, 1, \'+00:00\'), r.time(2013, 1, 1, \'+00:00\'), index=\'date\')\n        .order_by(index=\'date\').run(conn);\n\n'),
	(rethinkdb.ast.RqlQuery.sample, b"sequence.sample(number) -> selection\nstream.sample(number) -> array\narray.sample(number) -> array\n\nSelect a given number of elements from a sequence with uniform random distribution. Selection is done without replacement.\n\nIf the sequence has less than the requested number of elements (i.e., calling `sample(10)` on a sequence with only five elements), `sample` will return the entire sequence in a random order.\n\n*Example* Select 3 random heroes.\n\n    r.table('marvel').sample(3).run(conn)\n"),
	(rethinkdb.ast.RqlQuery.skip, b"sequence.skip(n) -> stream\narray.skip(n) -> array\n\nSkip a number of elements from the head of the sequence.\n\n*Example* Here in conjunction with [order_by](http://rethinkdb.com/api/python/order_by/) we choose to ignore the most successful heroes.\n\n    r.table('marvel').order_by('successMetric').skip(10).run(conn)\n\n"),
	(rethinkdb.ast.RqlQuery.slice, b'selection.slice(start_index[, end_index, left_bound=\'closed\', right_bound=\'open\']) -> selection\nstream.slice(start_index[, end_index, left_bound=\'closed\', right_bound=\'open\']) -> stream\narray.slice(start_index[, end_index, left_bound=\'closed\', right_bound=\'open\']) -> array\nbinary.slice(start_index[, end_index, left_bound=\'closed\', right_bound=\'open\']) -> binary\nstring.slice(start_index[, end_index, left_bound=\'closed\', right_bound=\'open\']) -> string\n\nReturn the elements of a sequence within the specified range.\n\n`slice` returns the range between `start_index` and `end_index`. If only `start_index` is specified, `slice` returns the range from that index to the end of the sequence. Specify `left_bound` or `right_bound` as `open` or `closed` to indicate whether to include that endpoint of the range by default: `closed` returns that endpoint, while `open` does not. By default, `left_bound` is closed and `right_bound` is open, so the range `(10,13)` will return the tenth, eleventh and twelfth elements in the sequence.\n\nIf `end_index` is past the end of the sequence, all elements from `start_index` to the end of the sequence will be returned. If `start_index` is past the end of the sequence or `end_index` is less than `start_index`, a zero-element sequence will be returned.\n\nNegative `start_index` and `end_index` values are allowed with arrays; in that case, the returned range counts back from the array\'s end. That is, the range `(-2)` returns the last two elements, and the range of `(2,-1)` returns the second element through the next-to-last element of the range. An error will be raised on a negative `start_index` or `end_index` with non-arrays. (An `end_index` of &minus;1 *is* allowed with a stream if `right_bound` is closed; this behaves as if no `end_index` was specified.)\n\nIf `slice` is used with a [binary](http://rethinkdb.com/api/python/binary) object, the indexes refer to byte positions within the object. That is, the range `(10,20)` will refer to the 10th byte through the 19th byte.\n\nWith a string, `slice` behaves similarly, with the indexes referring to Unicode codepoints. String indexes start at `0`. (Note that combining codepoints are counted separately.)\n\nIf you are only specifying the indexes and not the bounding options, you may use Python\'s slice operator as a shorthand: `[start_index:end_index]`.\n\n*Example* Return the fourth, fifth and sixth youngest players. (The youngest player is at index 0, so those are elements 3&ndash;5.)\n\n    r.table(\'players\').order_by(index=\'age\').slice(3,6).run(conn)\n\nOr, using Python\'s slice operator:\n\n    r.table(\'players\').filter({\'class\': \'amateur\'})[10:20].run(conn)\n\n*Example* Return all but the top three players who have a red flag.\n\n    r.table(\'players\').filter({\'flag\': \'red\'}).order_by(index=r.desc(\'score\')).slice(3).run(conn)\n\n*Example* Return holders of tickets `X` through `Y`, assuming tickets are numbered sequentially. We want to include ticket `Y`.\n\n    r.table(\'users\').order_by(index=\'ticket\').slice(x, y, right_bound=\'closed\').run(conn)\n\n*Example* Return the elements of an array from the second through two from the end (that is, not including the last two).\n\n    r.expr([0,1,2,3,4,5]).slice(2,-2).run(conn)\n    [2,3]\n\n*Example* Return the third through fifth characters of a string.\n\n    > r.expr("rutabaga").slice(2,5).run(conn)\n    "tab"\n'),
	(rethinkdb.ast.RqlQuery.union, b'stream.union(sequence[, sequence, ...][, interleave=True]) -> stream\narray.union(sequence[, sequence, ...][, interleave=True]) -> array\n\nMerge two or more sequences.\n\nThe optional `interleave` argument controls how the sequences will be merged:\n\n* `True`: results will be mixed together; this is the fastest setting, but ordering of elements is not guaranteed. (This is the default.)\n* `False`: input sequences will be appended to one another, left to right.\n* `"field_name"`: a string will be taken as the name of a field to perform a merge-sort on. The input sequences must be ordered _before_ being passed to `union`.\n\n*Example* Construct a stream of all heroes.\n\n    r.table(\'marvel\').union(r.table(\'dc\')).run(conn)\n\n*Example* Combine four arrays into one.\n\n    r.expr([1, 2]).union([3, 4], [5, 6], [7, 8, 9]).run(conn)\n    \n    [1, 2, 3, 4, 5, 6, 7, 8, 9]\n\n*Example* Create a changefeed from the first example.\n\n    r.table(\'marvel\').union(r.table(\'dc\')).changes().run(conn)\n\nNow, when any heroes are added, modified or deleted from either table, a change notification will be sent out.\n\n*Example* Merge-sort the tables of heroes, ordered by name.\n\n    r.table(\'marvel\').order_by(\'name\').union(\n        r.table(\'dc\').order_by(\'name\'), interleave=\'name\'\n    ).run(conn)\n'),
	(rethinkdb.ast.RqlQuery.with_fields, b"sequence.with_fields([selector1, selector2...]) -> stream\narray.with_fields([selector1, selector2...]) -> array\n\nPlucks one or more attributes from a sequence of objects, filtering out any objects in the sequence that do not have the specified fields. Functionally, this is identical to [has_fields](http://rethinkdb.com/api/python/has_fields/) followed by [pluck](http://rethinkdb.com/api/python/pluck/) on a sequence.\n\n*Example* Get a list of users and their posts, excluding any users who have not made any posts.\n\nExisting table structure:\n\n    [\n        { 'id': 1, 'user': 'bob', 'email': 'bob@foo.com', 'posts': [ 1, 4, 5 ] },\n        { 'id': 2, 'user': 'george', 'email': 'george@foo.com' },\n        { 'id': 3, 'user': 'jane', 'email': 'jane@foo.com', 'posts': [ 2, 3, 6 ] }\n    ]\n\nCommand and output:\n\n    r.table('users').with_fields('id', 'user', 'posts').run(conn)\n    \n    [\n        { 'id': 1, 'user': 'bob', 'posts': [ 1, 4, 5 ] },\n        { 'id': 3, 'user': 'jane', 'posts': [ 2, 3, 6 ] }\n    ]\n\n*Example* Use the [nested field syntax](http://rethinkdb.com/docs/nested-fields/) to get a list of users with cell phone numbers in their contacts.\n\n    r.table('users').with_fields('id', 'user', {contact: {'phone': 'work'}).run(conn)\n"),
	(rethinkdb.ast.Table.delete, b'table.delete([durability="hard", return_changes=False])\n    -> object\nselection.delete([durability="hard", return_changes=False])\n    -> object\nsingleSelection.delete([durability="hard", return_changes=False])\n    -> object\n\nDelete one or more documents from a table.\n\nThe optional arguments are:\n\n- `durability`: possible values are `hard` and `soft`. This option will override the\ntable or query\'s durability setting (set in [run](http://rethinkdb.com/api/python/run/)).  \nIn soft durability mode RethinkDB will acknowledge the write immediately after\nreceiving it, but before the write has been committed to disk.\n- `return_changes`:\n    - `True`: return a `changes` array consisting of `old_val`/`new_val` objects describing the changes made, only including the documents actually updated.\n    - `False`: do not return a `changes` array (the default).\n    - `"always"`: behave as `True`, but include all documents the command tried to update whether or not the update was successful. (This was the behavior of `True` pre-2.0.)\n\nDelete returns an object that contains the following attributes:\n\n- `deleted`: the number of documents that were deleted.\n- `skipped`: the number of documents that were skipped.  \nFor example, if you attempt to delete a batch of documents, and another concurrent query\ndeletes some of those documents first, they will be counted as skipped.\n- `errors`: the number of errors encountered while performing the delete.\n- `first_error`: If errors were encountered, contains the text of the first error.\n- `inserted`, `replaced`, and `unchanged`: all 0 for a delete operation.\n- `changes`: if `return_changes` is set to `True`, this will be an array of objects, one for each objected affected by the `delete` operation. Each object will have two keys: `{"new_val": None, "old_val": <old value>}`.\n\n*Example* Delete a single document from the table `comments`.\n\n    r.table("comments").get("7eab9e63-73f1-4f33-8ce4-95cbea626f59").delete().run(conn)\n\n*Example* Delete all documents from the table `comments`.\n\n    r.table("comments").delete().run(conn)\n\n*Example* Delete all comments where the field `id_post` is `3`.\n\n    r.table("comments").filter({"id_post": 3}).delete().run(conn)\n\n*Example* Delete a single document from the table `comments` and return its value.\n\n    r.table("comments").get("7eab9e63-73f1-4f33-8ce4-95cbea626f59").delete(return_changes=True).run(conn)\n\nThe result will look like:\n\n    {\n        "deleted": 1,\n        "errors": 0,\n        "inserted": 0,\n        "changes": [\n            {\n                "new_val": None,\n                "old_val": {\n                    "id": "7eab9e63-73f1-4f33-8ce4-95cbea626f59",\n                    "author": "William",\n                    "comment": "Great post",\n                    "id_post": 3\n                }\n            }\n        ],\n        "replaced": 0,\n        "skipped": 0,\n        "unchanged": 0\n    }\n\n*Example* Delete all documents from the table `comments` without waiting for the\noperation to be flushed to disk.\n\n    r.table("comments").delete(durability="soft"}).run(conn)\n'),
	(rethinkdb.ast.Table.insert, b'table.insert(object | [object1, object2, ...][, durability="hard", return_changes=False, conflict="error"])\n    -> object\n\nInsert documents into a table. Accepts a single document or an array of\ndocuments.\n\nThe optional arguments are:\n\n- `durability`: possible values are `hard` and `soft`. This option will override the table or query\'s durability setting (set in [run](http://rethinkdb.com/api/python/run/)). In soft durability mode RethinkDB will acknowledge the write immediately after receiving and caching it, but before the write has been committed to disk.\n- `return_changes`:\n    - `True`: return a `changes` array consisting of `old_val`/`new_val` objects describing the changes made, only including the documents actually updated.\n    - `False`: do not return a `changes` array (the default).\n    - `"always"`: behave as `True`, but include all documents the command tried to update whether or not the update was successful. (This was the behavior of `True` pre-2.0.)\n- `conflict`: Determine handling of inserting documents with the same primary key as existing entries. Possible values are `"error"`, `"replace"` or `"update"`.\n    - `"error"`: Do not insert the new document and record the conflict as an error. This is the default.\n    - `"replace"`: [Replace](http://rethinkdb.com/api/python/replace/) the old document in its entirety with the new one.\n    - `"update"`: [Update](http://rethinkdb.com/api/python/update/) fields of the old document with fields from the new one.\n\nIf `return_changes` is set to `True` or `"always"`, the `changes` array will follow the same order as the inserted documents. Documents in `changes` for which an error occurs (such as a key conflict) will have a third field, `error`, with an explanation of the error.\n\nInsert returns an object that contains the following attributes:\n\n- `inserted`: the number of documents successfully inserted.\n- `replaced`: the number of documents updated when `conflict` is set to `"replace"` or `"update"`.\n- `unchanged`: the number of documents whose fields are identical to existing documents with the same primary key when `conflict` is set to `"replace"` or `"update"`.\n- `errors`: the number of errors encountered while performing the insert.\n- `first_error`: If errors were encountered, contains the text of the first error.\n- `deleted` and `skipped`: 0 for an insert operation.\n- `generated_keys`: a list of generated primary keys for inserted documents whose primary keys were not specified (capped to 100,000).\n- `warnings`: if the field `generated_keys` is truncated, you will get the warning _"Too many generated keys (&lt;X&gt;), array truncated to 100000."_.\n- `changes`: if `return_changes` is set to `True`, this will be an array of objects, one for each objected affected by the `insert` operation. Each object will have two keys: `{"new_val": <new value>, "old_val": None}`.\n\n*Example* Insert a document into the table `posts`.\n\n    r.table("posts").insert({\n        "id": 1,\n        "title": "Lorem ipsum",\n        "content": "Dolor sit amet"\n    }).run(conn)\n\n<!-- stop -->\n\nThe result will be:\n\n    {\n        "deleted": 0,\n        "errors": 0,\n        "inserted": 1,\n        "replaced": 0,\n        "skipped": 0,\n        "unchanged": 0\n    }\n\n*Example* Insert a document without a defined primary key into the table `posts` where the\nprimary key is `id`.\n\n    r.table("posts").insert({\n        "title": "Lorem ipsum",\n        "content": "Dolor sit amet"\n    }).run(conn)\n\nRethinkDB will generate a primary key and return it in `generated_keys`.\n\n    {\n        "deleted": 0,\n        "errors": 0,\n        "generated_keys": [\n            "dd782b64-70a7-43e4-b65e-dd14ae61d947"\n        ],\n        "inserted": 1,\n        "replaced": 0,\n        "skipped": 0,\n        "unchanged": 0\n    }\n\nRetrieve the document you just inserted with:\n\n    r.table("posts").get("dd782b64-70a7-43e4-b65e-dd14ae61d947").run(conn)\n\nAnd you will get back:\n\n    {\n        "id": "dd782b64-70a7-43e4-b65e-dd14ae61d947",\n        "title": "Lorem ipsum",\n        "content": "Dolor sit amet",\n    }\n\n*Example* Insert multiple documents into the table `users`.\n\n    r.table("users").insert([\n        {"id": "william", "email": "william@rethinkdb.com"},\n        {"id": "lara", "email": "lara@rethinkdb.com"}\n    ]).run(conn)\n\n*Example* Insert a document into the table `users`, replacing the document if the document\nalready exists.  \n\n    r.table("users").insert(\n        {"id": "william", "email": "william@rethinkdb.com"},\n        conflict="replace"\n    ).run(conn)\n\n*Example* Copy the documents from `posts` to `posts_backup`.\n\n    r.table("posts_backup").insert( r.table("posts") ).run(conn)\n\n*Example* Get back a copy of the inserted document (with its generated primary key).\n\n    r.table("posts").insert(\n        {"title": "Lorem ipsum", "content": "Dolor sit amet"},\n        return_changes=True\n    ).run(conn)\n\nThe result will be\n\n    {\n        "deleted": 0,\n        "errors": 0,\n        "generated_keys": [\n            "dd782b64-70a7-43e4-b65e-dd14ae61d947"\n        ],\n        "inserted": 1,\n        "replaced": 0,\n        "skipped": 0,\n        "unchanged": 0,\n        "changes": [\n            {\n                "old_val": None,\n                "new_val": {\n                    "id": "dd782b64-70a7-43e4-b65e-dd14ae61d947",\n                    "title": "Lorem ipsum",\n                    "content": "Dolor sit amet"\n                }\n            }\n        ]\n    }\n'),
	(rethinkdb.ast.Table.replace, b'table.replace(object | function[, durability="hard", return_changes=False, non_atomic=False])\n    -> object\nselection.replace(object | function[, durability="hard", return_changes=False, non_atomic=False])\n    -> object\nsingleSelection.replace(object | function[, durability="hard", return_changes=False, non_atomic=False])\n    -> object\n\nReplace documents in a table. Accepts a JSON document or a ReQL expression,\nand replaces the original document with the new one. The new document must\nhave the same primary key as the original document.\n\nThe `replace` command can be used to both insert and delete documents. If\nthe "replaced" document has a primary key that doesn\'t exist in the table,\nthe document will be inserted; if an existing document is replaced with\n`None`, the document will be deleted. Since `update` and `replace` operations\nare performed atomically, this allows atomic inserts and deletes as well.\n\nThe optional arguments are:\n\n- `durability`: possible values are `hard` and `soft`. This option will override\n  the table or query\'s durability setting (set in [run](http://rethinkdb.com/api/python/run/)). In\n  soft durability mode RethinkDB will acknowledge the write immediately after\n  receiving it, but before the write has been committed to disk.\n- `return_changes`:\n    - `True`: return a `changes` array consisting of `old_val`/`new_val` objects\n      describing the changes made, only including the documents actually\n      updated.\n    - `False`: do not return a `changes` array (the default).\n    - `"always"`: behave as `True`, but include all documents the command tried\n      to update whether or not the update was successful. (This was the behavior\n      of `True` pre-2.0.)\n- `non_atomic`: if set to `True`, executes the replacement and distributes the\n  result to replicas in a non-atomic fashion. This flag is required to perform\n  non-deterministic updates, such as those that require reading data from\n  another table.\n\nReplace returns an object that contains the following attributes:\n\n- `replaced`: the number of documents that were replaced.\n- `unchanged`: the number of documents that would have been modified, except\n  that the new value was the same as the old value.\n- `inserted`: the number of new documents added. A document is considered inserted if its primary key did not exist in the table at the time of the `replace` operation.\n- `deleted`: the number of deleted documents when doing a replace with `None`.\n- `errors`: the number of errors encountered while performing the replace.\n- `first_error`: If errors were encountered, contains the text of the first\n  error.\n- `skipped`: 0 for a replace operation.\n- `changes`: if `return_changes` is set to `True`, this will be an array of\n  objects, one for each objected affected by the `replace` operation. Each\n  object will have two keys: `{"new_val": <new value>, "old_val": <old value>}`.\n\n*Example* Replace the document with the primary key `1`.\n\n    r.table("posts").get(1).replace({\n        "id": 1,\n        "title": "Lorem ipsum",\n        "content": "Aleas jacta est",\n        "status": "draft"\n    }).run(conn)\n\n*Example* Remove the field `status` from all posts.\n\n    r.table("posts").replace(lambda post:\n        post.without("status")\n    ).run(conn)\n\n*Example* Remove all the fields that are not `id`, `title` or `content`.\n\n    r.table("posts").replace(lambda post:\n        post.pluck("id", "title", "content")\n    ).run(conn)\n\n*Example* Replace the document with the primary key `1` using soft durability.\n\n    r.table("posts").get(1).replace({\n        "id": 1,\n        "title": "Lorem ipsum",\n        "content": "Aleas jacta est",\n        "status": "draft"\n    }, durability="soft").run(conn)\n\n*Example* Replace the document with the primary key `1` and return the values of the document before\nand after the replace operation.\n\n    r.table("posts").get(1).replace({\n        "id": 1,\n        "title": "Lorem ipsum",\n        "content": "Aleas jacta est",\n        "status": "published"\n    }, return_changes=True).run(conn)\n\nThe result will have a `changes` field:\n\n    {\n        "deleted": 0,\n        "errors":  0,\n        "inserted": 0,\n        "changes": [\n            {\n                "new_val": {\n                    "id":1,\n                    "title": "Lorem ipsum"\n                    "content": "Aleas jacta est",\n                    "status": "published",\n                },\n                "old_val": {\n                    "id":1,\n                    "title": "Lorem ipsum"\n                    "content": "TODO",\n                    "status": "draft",\n                    "author": "William",\n                }\n            }\n        ],   \n        "replaced": 1,\n        "skipped": 0,\n        "unchanged": 0\n    }\n'),
	(rethinkdb.ast.Table.sync, b'table.sync() -> object\n\n`sync` ensures that writes on a given table are written to permanent storage. Queries\nthat specify soft durability (`durability=\'soft\'`) do not give such guarantees, so\n`sync` can be used to ensure the state of these queries. A call to `sync` does not return\nuntil all previous writes to the table are persisted.\n\nIf successful, the operation returns an object: `{"synced": 1}`.\n\n*Example* After having updated multiple heroes with soft durability, we now want to wait\nuntil these changes are persisted.\n\n    r.table(\'marvel\').sync().run(conn)\n\n'),
	(rethinkdb.ast.Table.update, b'table.update(object | function[, durability="hard", return_changes=False, non_atomic=False])\n    -> object\nselection.update(object | function[, durability="hard", return_changes=False, non_atomic=False])\n    -> object\nsingleSelection.update(object | function[, durability="hard", return_changes=False, non_atomic=False])\n    -> object\n\nUpdate JSON documents in a table. Accepts a JSON document, a ReQL expression, or a combination of the two.\n\nThe optional arguments are:\n\n- `durability`: possible values are `hard` and `soft`. This option will override the table or query\'s durability setting (set in [run](http://rethinkdb.com/api/python/run/)). In soft durability mode RethinkDB will acknowledge the write immediately after receiving it, but before the write has been committed to disk.\n- `return_changes`:\n    - `True`: return a `changes` array consisting of `old_val`/`new_val` objects describing the changes made, only including the documents actually updated.\n    - `False`: do not return a `changes` array (the default).\n    - `"always"`: behave as `True`, but include all documents the command tried to update whether or not the update was successful. (This was the behavior of `True` pre-2.0.)\n- `non_atomic`: if set to `True`, executes the update and distributes the result to replicas in a non-atomic fashion. This flag is required to perform non-deterministic updates, such as those that require reading data from another table.\n\nUpdate returns an object that contains the following attributes:\n\n- `replaced`: the number of documents that were updated.\n- `unchanged`: the number of documents that would have been modified except the new value was the same as the old value.\n- `skipped`: the number of documents that were skipped because the document didn\'t exist.\n- `errors`: the number of errors encountered while performing the update.\n- `first_error`: If errors were encountered, contains the text of the first error.\n- `deleted` and `inserted`: 0 for an update operation.\n- `changes`: if `return_changes` is set to `True`, this will be an array of objects, one for each objected affected by the `update` operation. Each object will have two keys: `{"new_val": <new value>, "old_val": <old value>}`.\n\n*Example* Update the status of the post with `id` of `1` to `published`.\n\n    r.table("posts").get(1).update({"status": "published"}).run(conn)\n\n*Example* Update the status of all posts to `published`.\n\n    r.table("posts").update({"status": "published"}).run(conn)\n\n*Example* Update the status of all the posts written by William.\n\n    r.table("posts").filter({"author": "William"}).update({"status": "published"}).run(conn)\n\n*Example* Increment the field `view` of the post with `id` of `1`.\nThis query will throw an error if the field `views` doesn\'t exist.\n\n    r.table("posts").get(1).update({\n        "views": r.row["views"]+1\n    }).run(conn)\n\n*Example* Increment the field `view` of the post with `id` of `1`.\nIf the field `views` does not exist, it will be set to `0`.\n\n    r.table("posts").get(1).update({\n        "views": (r.row["views"]+1).default(0)\n    }).run(conn)\n\n*Example* Perform a conditional update.  \nIf the post has more than 100 views, set the `type` of a post to `hot`, else set it to `normal`.\n\n    r.table("posts").get(1).update(lambda post:\n        r.branch(\n            post["views"] > 100,\n            {"type": "hot"},\n            {"type": "normal"}\n        )\n    ).run(conn)\n\n*Example* Update the field `num_comments` with the result of a sub-query. Because this update is not atomic, you must pass the `non_atomic` flag.\n\n    r.table("posts").get(1).update({\n        "num_comments": r.table("comments").filter({"id_post": 1}).count()\n    }, non_atomic=True).run(conn)\n\nIf you forget to specify the `non_atomic` flag, you will get a `ReqlRuntimeError`:\n\nReqlRuntimeError: Could not prove function deterministic.  Maybe you want to use the non_atomic flag? \n\n*Example* Update the field `num_comments` with a random value between 0 and 100. This update cannot be proven deterministic because of `r.js` (and in fact is not), so you must pass the `non_atomic` flag.\n\n    r.table("posts").get(1).update({\n        "num_comments": r.js("Math.floor(Math.random()*100)")\n    }, non_atomic=True).run(conn)\n\n*Example* Update the status of the post with `id` of `1` using soft durability.\n\n    r.table("posts").get(1).update({status: "published"}, durability="soft").run(conn)\n\n*Example* Increment the field `views` and return the values of the document before and after the update operation.\n\n    r.table("posts").get(1).update({\n        "views": r.row["views"]+1\n    }, return_changes=True).run(conn)\n\nThe result will now include a `changes` field:\n\n    {\n        "deleted": 0,\n        "errors": 0,\n        "inserted": 0,\n        "changes": [\n            {\n                "new_val": {\n                    "id": 1,\n                    "author": "Julius_Caesar",\n                    "title": "Commentarii de Bello Gallico",\n                    "content": "Aleas jacta est",\n                    "views": 207\n                },\n                "old_val": {\n                    "id": 1,\n                    "author": "Julius_Caesar",\n                    "title": "Commentarii de Bello Gallico",\n                    "content": "Aleas jacta est",\n                    "views": 206\n                }\n            }\n        ],\n        "replaced": 1,\n        "skipped": 0,\n        "unchanged": 0\n    }\n\nThe `update` command supports RethinkDB\'s nested field syntax to update subdocuments. Consider a user table with contact information in this format:\n\n    {\n        "id": 10001,\n        "name": "Bob Smith",\n        "contact": {\n            "phone": {\n                "work": "408-555-1212",\n                "home": "408-555-1213",\n                "cell": "408-555-1214"\n            },\n            "email": {\n                "work": "bob@smith.com",\n                "home": "bobsmith@example.com",\n                "other": "bobbys@moosecall.net"\n            },\n            "im": {\n                "skype": "Bob Smith",\n                "aim": "bobmoose",\n                "icq": "nobodyremembersicqnumbers"\n            }\n        },\n        "notes": [\n            {\n                "date": r.time(2014,1,1,\'Z\'),\n                "from": "John Doe",\n                "subject": "My name is even more boring than Bob\'s"\n            },\n            {\n                "date": r.time(2014,2,2,\'Z\'),\n                "from": "Bob Smith Sr",\n                "subject": "Happy Second of February"\n            }\n        ]\n    }\n\n*Example* Update Bob Smith\'s cell phone number.\n\n    r.table("users").get(10001).update(\n        {"contact": {"phone": {"cell": "408-555-4242"}}}\n    ).run(conn)\n\n*Example* Add another note to Bob Smith\'s record.\n\n    new_note = {\n        "date": r.now(),\n        "from": "Inigo Montoya",\n        "subject": "You killed my father"\n    }\n    r.table("users").get(10001).update(\n        {"notes": r.row["notes"].append(new_note)}\n    ).run(conn)\n\n*Example* Send a note to every user with an ICQ number.\n\n    icq_note = {\n        "date": r.now(),\n        "from": "Admin",\n        "subject": "Welcome to the future"\n    }\n    r.table("users").filter(\n        r.row.has_fields({"contact": {"im": "icq"}})\n    ).update(\n        {"notes": r.row["notes"].append(icq_note)}\n    ).run(conn)\n\n*Example* Replace all of Bob\'s IM records. Normally, `update` will merge nested documents together; to replace the entire `"im"` document, use the literal command.\n\n    r.table(\'users\').get(10001).update(\n        {"contact": {"im": r.literal({"aim": "themoosemeister"})}}\n    ).run(conn)\n'),
]

for function, text in docsSource:
	try:
		text = str(text.decode('utf-8'))
	except UnicodeEncodeError:
		pass
	if hasattr(function, "__func__"):
		function.__func__.__doc__ = text
	else:
		function.__doc__ = text
