Created
January 22, 2014 05:20
-
-
Save jdsiddon/8553839 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
saveGunListings: function(arrayOfAuctionItems, callback) { | |
if (err) { | |
console.log("Error connecting to DB: " + err); | |
} else { | |
(itr = function() { | |
if (arrayOfAuctionItems.length > 0) { | |
var temp = arrayOfAuctionItems.pop(); | |
console.log(temp); | |
/* Add back when dont with looping | |
gun.find({ id: temp }, function (err, guns) { | |
if (err) { | |
console.log("Can't find document: " + err); | |
} | |
if (Object.keys(guns).length > 0) { // If any gun documents already exist | |
console.log("+++ Gun listing aleady entered! +++"); | |
} else { // No gun documents exist for that id, save to db. | |
console.log("New Auction Item! Saving to DB..."); | |
} | |
itr(); | |
}); /*end find */ | |
})(); | |
} else { | |
} | |
callback(null, "new guns saved!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment