mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
16 lines
426 B
CoffeeScript
16 lines
426 B
CoffeeScript
|
mongojs = require("../../infrastructure/mongojs")
|
||
|
db = mongojs.db
|
||
|
ObjectId = mongojs.ObjectId
|
||
|
|
||
|
module.exports = UserGetter =
|
||
|
getUser: (query, projection, callback = (error, user) ->) ->
|
||
|
if arguments.length == 2
|
||
|
callback = projection
|
||
|
projection = {}
|
||
|
if typeof query == "string"
|
||
|
query = _id: ObjectId(query)
|
||
|
else if query instanceof ObjectId
|
||
|
query = _id: query
|
||
|
|
||
|
db.users.findOne query, projection, callback
|