public void testBooks() {
    Set<Class<?>> classes = Sets.newHashSet();
    classes.add(Book.class);
    IMappingContextFactory<?> factory =
        new IMappingContextFactory<IMappingContext>() {
          @Override
          public IMappingContext newContext() {
            return new ColorMappingContext();
          }
        };
    Transformations transformations = new Transformations(factory, classes);
    IDatastore datastore = new Datastore(getMongo(), getDatabaseName(), transformations);
    datastore.ensureCaps();
    datastore.ensureIndexes();

    Book book = new Book();
    book.setName("Bla");
    datastore.save(book);
    book.setName("Blu");
    datastore.update(book);
    book = new Book();
    book.setName("2. Buch");
    datastore.save(book);

    List<Book> books = datastore.find(Book.class);
    assertEquals("Size", 2, books.size());
    //		System.out.println("Books: "+books);

    books = datastore.with(Book.class).field(Book.Name).eq("Blu").result().asList();
    assertEquals("Size", 1, books.size());

    for (int i = 0; i < 10; i++) {
      book = new Book();
      book.setName(i + ". Buch");
      datastore.save(book);
    }

    books = datastore.with(Book.class).result().order("name", false).asList();
    System.out.println("Books: " + books);
    assertEquals("Size", 9, books.size());
    assertEquals("9. Buch", "9. Buch", books.get(0).getName());
  }
 @Override
 public void onWrite(Book entity) {
   if (entity._name != null) entity._nameLen = entity._name.length();
 }