Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function findOrCreate() {
db.find(id)
.then(function(r){
if(!r) {
db.create(id)
.then(r) {
return "success"
}
} else {
return "error"
}
})
function findOrCreate() {
var r = db.find(id);
if(!r) {
db.create(id);
return "success"
} else {
return "error";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.