Added a legacy flag to be able to use mongoose models directly.