It turns out it was an error with the Mongoose version. I was using 3.6, after upgrading to 4.4.20 it started working.