mongo v0.5.4 Mongo.Response

Receives, decode and parse MongoDB response from the server

Summary

Functions

Decodes an aggregate respsonse

Helper fuction to decode the first document of a bson buffer

Helper fuction to split buffer into documents in binary format

Decodes a command response

Decodes a count respsonse

Decodes a distinct respsonse

Decodes an error respsonse

Decodes a getnonce respsonse

Decodes a group respsonse

Decodes a map-reduce respsonse

Decodes a success respsonse

Functions

aggregate(response)

Decodes an aggregate respsonse

Returns {:ok, result} or transfers the error message

bson_decode(buffer, opts \\ %Bson.Decoder{})

Helper fuction to decode the first document of a bson buffer

bson_no_decoding(buffer)

Helper fuction to split buffer into documents in binary format

cmd(response)

Decodes a command response

Returns {:ok, doc} or transfers the error message

count(response)

Decodes a count respsonse

Returns {:ok, n} or transfers the error message

distinct(response)

Decodes a distinct respsonse

Returns {:ok, values} or transfers the error message

error(response)

Decodes an error respsonse

Returns {:ok, nonce} or transfers the error message

getnonce(response)

Decodes a getnonce respsonse

Returns {:ok, nonce} or transfers the error message

group(response)

Decodes a group respsonse

Returns {:ok, retval} or transfers the error message

mr(response)

Decodes a map-reduce respsonse

Returns {:ok, results} (inline) or :ok or transfers the error message

new(arg, decoder \\ &(Mongo.Response.bson_decode(&1)))

Parses a response message

If the message is partial, this method makes shure the response is complete by fetching additional messages

success(response)

Decodes a success respsonse

Returns :ok or transfers the error message