Created
November 19, 2019 14:36
-
-
Save tnovau/95e38abb30d1c4b8ee765908cee315c6 to your computer and use it in GitHub Desktop.
Create One document - Mongoose snippet
This file contains hidden or 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 kitty = { name: 'Zildjian' }; | |
/** | |
* @param {Object} doc | |
*/ | |
const createOne = async doc => { | |
const savedDocument = await Cat.create(kitty); | |
return { ...kitty, id: savedDocument.id }; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment