# 3. Query Server

The Query server is an external process that communicates with CouchDB by JSON protocol through stdio interface and processes all design functions calls, such as JavaScript views.

The default query server is written in JavaScript, running via Mozilla SpiderMonkey. You can use other languages by setting a Query server key in the `language` property of a design document or the Content-Type header of a temporary view. Design documents that do not specify a `language` property are assumed to be of type javascript.

- 3.1. Query Server Protocol
  - 3.1.1. `reset`
  - 3.1.2. `add_lib`
  - 3.1.3. `add_fun`
  - 3.1.4. `map_doc`
  - 3.1.5. `reduce`
  - 3.1.6. `rereduce`
  - 3.1.7. `ddoc`
  - 3.1.8. Returning errors
  - 3.1.9. Logging
- 3.2. JavaScript
  - 3.2.1. Design functions context
  - 3.2.2. CommonJS Modules
- 3.3. Erlang