Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
We figured something out
It's not the first one, its the second one that gets inputed into the array that shows up in the array.
@ihatecomputers
itemfunctions.addItem = function(itemname, username) {
User.findOne({username: username}, (err, user) => {
var users = user;
var item = itemfunctions.itemInvTemplate;
var iteminfo = itemfunctions.getItem(itemname);
item.name = itemname;
item.durabilty = iteminfo.durability;
users.inventory.push(item);
User.findOneAndUpdate({username: username}, users, {upsert:true}, function(err, doc){
console.log(err);
console.log("a");
return;
});
});
}
here's where the array is delcared
inventory: [{name: String, durability: Number, metadata: [String]}] -
tokumei21316yOn the plus side, at least you'll be able to push yourself once you understand, then fix it and add others as you tell them how absurd this bug was
Related Rants
I'm going to kill myself.
In the nodejs server for my game, there's a function that pushes to an array.
It only works if the array is empty, no matter what type it is.
List of people that know why
- none
rant
arrays
nodejs
js