overleaf/services/web/app/coffee/Features/User/UserLocator.coffee

13 lines
318 B
CoffeeScript
Raw Normal View History

2014-02-12 10:23:40 +00:00
mongojs = require("../../infrastructure/mongojs")
db = mongojs.db
ObjectId = mongojs.ObjectId
module.exports =
findByEmail: (email, callback)->
email = email.trim()
db.users.findOne email:email, (err, user)->
callback(err, user)
findById: (_id, callback)->
db.users.findOne _id:ObjectId(_id+""), callback