Last active
March 20, 2018 03:18
-
-
Save Anderson-Juhasc/a41817fbf58503dfde40f95734acce91 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const find = ( Model ) => ( query, sort = {} ) => | |
Model.find({}).or( query ).sort( sort ).exec() | |
const findOne = ( Model ) => ( query, populate = '' ) => | |
Model.findOne( query ).populate( populate ).exec() | |
const count = ( Model ) => ( query ) => | |
Model.count( query ).exec() | |
const save = ( Model ) => | |
Model.save().then() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const test = async () => { | |
let user = await findOne( UserModel )( { email: email } ) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment