Rename JSStaticFunction to JSStaticFunctionAnnotation.

JSFunction is imported as JSFunctionAnnotation to distinguish it from
JSFunction type alias. Use the same naming convention for JSStaticFunction to
make naming consistent.
Add Future.andThen function.

andThen applies the side-effecting function to the result of this future, and
returns a new future with the result of this future.

This method allows one to enforce that the callbacks are executed in a
specified order.
Make ScriptableDocument.findOne() succeed even when there is no matching data.

Currently, findOne method returns a failed future with
NoSuchElementException if there is no matching data. This behavior is
inconsist with find method - find method returns an empty array.

This patch makes findOne method return a successful future whose value
is null.
Fix a bug in ScriptableFuture.onSuccess method.

Currently, onSuccess callback of ScriptableFuture is not called if the
result is null because null is not matched with AnyRef.
Modify findOne example to check if result is null.

result can be null if there is no matching data.
Make scalastyle warn when code exceeds the maximum cyclomatic complexity.

Currently, scalastyle errors when code exceeds the maximum cyclomatic
complexity (currently 10). It's helpful mostly but it makes code verbose in
some cases.
Adjust relations between Scala, JavaScript and BSON types.

Currentlym Scala, JavaScript and BSON types are not consistently used. This
patch adjusts their relations.

There are three kind of types:
 - JavaScript type: used by Rhino engine
 - Scala type: intermediate type used by Scala code
 - BSON type: used by database

The conversion table is:

 JavaScriptType  | ScalaType            | BSONType
-----------------+----------------------+----------------
 NativeObject    | Map[String, AnyRef]  | BSONDocument
 NativeArray     | Seq[AnyRef]          | BSONArray
 NativeNumber    | Int                  | BSONInteger
                 | Long                 | BSONLong
                 | Double               | BSONDouble
 NativeBoolean   | Boolean              | BSONBoolean
 NativeDate      | Date                 | BSONDateTime
 NativeUndefined | Undefined            | BSONUndefined
 NativeFunction  | String               | BSONJavaScript

JavaScript types can be converted to Scala types with Field and Scala types can
be converted to JavaScript types with Context and Scope.  Scala types are
convertible to BSON types and vice versa.  But JavaScript types and BSON types
cannot be converted to each other directly.

ScriptableDocument contains data as BSON Type, and converts to JavaScript type
when the engine requests it.

Scala types seem to be useless because it's not used by engine nor database,
but code becomes complicated without these types because the Rhino engine
automatically converts primitive types with toSource method of Native*.
Add ObjectID wrapper.

Currently, there is no way to find a document with object id.
This patch adds ObjectID wrapper. A user can use this wrapper with
require('db').ObjectID().

This patch also adds examples of how to use ObjectID.
Implement the reference type for DB field.

The purpose of reference field is to reference a document. This field will
store the object id of the document. The getter of a reference type field
returns the future of the document referenced by this field.

And this patch adds three examples of how to use reference type.
Add embedding field.

Embedding field is used to store an object. This type must be used with a
schema.

See https://github.com/SollmoStudio/beyond/wiki/Beyond-DB-API-Schema for
more information.
Make reference field return ObjectID.

Currently, reference field returns Future of document for convenience.
However, only the object id is needed in some use cases. This patch makes
reference fied return ObjectID instead. When a user needs the corresponding
document, the user must call findOne.
Fix a grammar error.
Remove invalid comments.

bodyAsJson is already implemented.
Implement ScriptableFileSystem.

It's an interface to provide JavaScript API for handling file system.
Now only basic functions are implemented to read and write files.
The API design is found in the Wiki page below.

https://github.com/SollmoStudio/beyond/wiki/Beyond-File-System-API