mirror of
https://github.com/HackPlan/RootPanel.git
synced 2026-04-23 19:21:04 +08:00
使用findone重写findById
This commit is contained in:
@@ -105,10 +105,4 @@ module.exports = class Model
|
||||
|
||||
# id为string
|
||||
@findById: (id, opts = {}, callback) ->
|
||||
if _.isFunction opts
|
||||
callback = opts
|
||||
opts = {}
|
||||
@collection().findOne {_id: id}, (err, doc) =>
|
||||
throw err if err
|
||||
result = @create doc
|
||||
callback err, result
|
||||
@findOne {_id: id},opts,callback
|
||||
|
||||
Reference in New Issue
Block a user