diff --git a/src/Collection.js b/src/Collection.js index 639114f..308be6e 100644 --- a/src/Collection.js +++ b/src/Collection.js @@ -7,12 +7,25 @@ export default function(name) { return { find(selector, options) { - if(typeof selector == 'string') return [Data.db[name].findOne({_id: selector}, options)]; + if(typeof selector == 'string') { + if(options) { + return [Data.db[name].findOne({_id: selector}, options)]; + } else { + return [Data.db[name].get(selector)]; + } + } return Data.db[name].find(selector, options); }, findOne(selector, options) { - if(typeof selector == 'string') return Data.db[name].findOne({_id: selector}, options); + + if(typeof selector == 'string') { + if(options) { + return Data.db[name].findOne({_id: selector}, options); + } else { + return Data.db[name].get(selector); + } + } return Data.db[name] && Data.db[name].findOne(selector, options) },