You cannot just return a value inside an asynchronous execution context
The problem is with this line:
var users = User.findAll();
User.findAll();
returns a query object (before the request even happens).
so res.json(users);
tries to stringify the query object which has circular structure.
From the docs:
Query#find([criteria], [callback])
Finds documents.
Parameters:
[criteria]
<Object>
mongodb selector
[callback]
<Function>
Returns:
<Query>
thisWhen no callback is passed, the query is not executed.
Recommended solution
You can use static methods:
userSchema.statics.findAll = function (cb) {
this.find(cb);
}