Make ScriptableQuery handle ScriptableObjectId.

Currently, ScriptableQuery cannot handle ScriptableObjectId because it uses
AnyRefBSONHandler directly. We need to make AnyRefBSONHandler handle
ScriptableObjectId or make ScriptableQuery change ScriptableObjectId to
ObjectId before using AnyRefBSONHandler.

I chose the second option because AnyRefBSONHandler is used by
ScriptableDocument with convertJavaScriptToScalaWithField method.
ScriptableObjectId is not passed to AnyRefBSONHandler in this case.
Remove unused imports.
Use type matching instead of extractor in convertJavaScriptToScalaWithField method.

Extractor makes code verbose in this case.
Add validations field on schema.

Currently, only min/max validations for numeric values are implemented.
Validate before save and insert of document.
Make the query constructor create an equal query.

Most queries are equal queries. So this patch adds a binary constructor to
create an equal query; the first argument is key and the second argument is
value.

For example, the two queries below represent the same query.

 require('db').query('fieldName', value);
 require('db').query().eq('fieldName', value);
Make removeOne method consume ScriptableDocument.

Currently, removeOne method only consumes a query. This patch makes the method
also consume a document.
Add count command to DB API.

This API can be used as find or findOne, but it returns the number of the
matching document.  It uses count command internally, so it's more efficient
than using find and getting the length of the result.

This patch also adds an example of using count command.
Add limit option to ScriptableCollection.find method.

Currently, ScriptableCollection.find method returns all matching results.
This patch makes the method limit the number of the results.

For example,
`collection.find(query)' will return all results, but
`collection.find(query, 3)' will return only the first three results.

Actually limit doesn't limit the number of documents fetched from the network.
It just reduces the conversion overhead.
Sort scriptable classes array in BeyondGlobal.scala

To avoid conflict in the future.
Use ScriptRuntime to get Array[Byte] in ScriptableCrypto.

A JSArray element can't be casted to Array[Int] directly.
Move the default encoding to BeyondConfiguration.

Encoding would be used quite often in the future, so it'd be
better to have one shared configuration here.
Implement ScriptableBuffer.

ScriptableBuffer is an implementation of `Buffer` class in Rhino.
It basically provides methods to manipulate buffers with String and
Byte. An example code representing the usage of the class is also
added in the `examples` directory in plugins.