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

13 lines
344 B
CoffeeScript
Raw Normal View History

2014-02-12 05:23:40 -05:00
mongojs = require("../../infrastructure/mongojs")
db = mongojs.db
ObjectId = mongojs.ObjectId
module.exports = UserUpdater =
updateUser: (query, update, callback = (error) ->) ->
if typeof query == "string"
query = _id: ObjectId(query)
else if query instanceof ObjectId
query = _id: query
db.users.update query, update, callback