Last active
January 11, 2019 12:17
-
-
Save pablocattaneo/503a91249699cd1b7238642a816121da to your computer and use it in GitHub Desktop.
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
_ |
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
Source: http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#insertOne | |
// getDb is a fiction function that connect database and return a client | |
db.getDb() | |
.db() | |
.collection('collectionName') | |
.insertOne(documentToInsert).then(()=> { | |
// Code after mongodb stored the document in the collection | |
}).catch(err => { | |
// error managing | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment