Im just trying to insert a number of values into Firebase, for analysis reasons. In fact, im testing the database for a university project. The idea was to get the time it takes to insert and retrieve data.
The code im doing is simple, but it wont insert into the database the number of messages i want.
function sendMessage(times){
for(let i = 0; i < times; i++){
console.log(i); // this prints 50 times
let messageObj = {
user: "testUser" + i,
message: "message" + i
};
firebase.database().ref("History/" + Date.now()).set(messageObj); // this executes only a random number of times
}
window.onload = function () {
sendMessage(50);
}
Here is an image of the data inserted into Firebase Realtime Database.
As you can see, the data is being inserted in a random way. Why is this happening? Thanks in advance.
