Can't wrap Mongo based classes inside a module?

Hi
I’m writing a small script to move some kind of data between databases. The issue is that when I try to wrap the Mongoid based classes, the code crashed.
Here’s a sample:

require 'mongoid'
Mongoid.configure do |config|
  config.clients.default = {
    hosts: ['localhost:27017'],
    database: 'test'
  }
  config.log_level = :warn
end
class Book
  include Mongoid::Document
  field :title
end
puts Book.first.title

This works fine:

Title of Book

But, if I do

module Mongodb
  require 'mongoid'
  Mongoid.configure do |config|
    config.clients.default = {
      hosts: ['localhost:27017'],
      database: 'test'
    }
    config.log_level = :warn
  end
  class Book 
    include Mongoid::Document
    field :title
  end
end
puts Mongodb::Book.first.title

The code crashes

main.rb:28:in `<main>': undefined method `title' for nil:NilClass (NoMethodError)

Kind regards.