Update to support 4.0.0.beta1

There were basically 2 changes that broke the tests.

Document#metadata is now Document#__metadata, and scopes must be a lambda.

Hope this helps.