Firebase added data automatically being deleted

Multi tool use
Multi tool use












0















I'm trying to add data to an arbitrary path in Firebase real-time database with the Javascript SDK.



All rules are public, so permissions shouldn't be an issue. (read = true, write = true)



Here's my code so far, for the addition of data:



function writeUserData(user, taskId, email, password, status) {
firebase.database().ref('users/' + user + '/tasks-status/' + taskId).set({
email: email,
password : password,
status: status,
});
}


Current project architecture is like this:






{
"roles" : {
"UID" : "owner"
},
"topics" : ["bio"],
"users" : {
"mffUzP5wtBRhOHTVAhGctAUHsa72" : {
"credits" : -5
},
"qfh75zQbIfe8ooAWAB3rbcz4MBQ2" : {
"credits" : 5
}
}
}





And I want to programmatically add a child tasks-status to the users/UID for each user, and three more children to that one. Ideally, the tasks-status node will stay, and later requests will just add the unique TaskID node (mffUzP5wtBRhOHTVAhGctAUHsa721).



Example:



"users" : {
"mffUzP5wtBRhOHTVAhGctAUHsa72" : {
"credits" : -5,
"tasks-status" : {
"mffUzP5wtBRhOHTVAhGctAUHsa721" : {
"email": EMAIL,
"password": PASSWORD,
"status": STATUS
}
}
},


But for some reason, the set adds the data to the database, but it's highlighted red and automatically removed. In addition, I found that other child nodes of users/UID were also deleted. Also, just wanted to note that I'm not using this for authentication, I'm already familiar and using Firebase Auth.



I've read over the docs about set/update and can't seem to find an answer.



Here's a picture of what I mean, the red is the data that I want to add but is subsequently deleted





Any help would be greatly appreciated!










share|improve this question

























  • Do you also have a Cloud Functions database trigger that's doing something in response to your addition of data?

    – Doug Stevenson
    Dec 29 '18 at 19:05











  • @DougStevenson No I don't, but I think its because I'm including the write function in a for loop, and it's getting called at the same time, so it might be getting over written.

    – ezhong
    Jan 2 at 14:53
















0















I'm trying to add data to an arbitrary path in Firebase real-time database with the Javascript SDK.



All rules are public, so permissions shouldn't be an issue. (read = true, write = true)



Here's my code so far, for the addition of data:



function writeUserData(user, taskId, email, password, status) {
firebase.database().ref('users/' + user + '/tasks-status/' + taskId).set({
email: email,
password : password,
status: status,
});
}


Current project architecture is like this:






{
"roles" : {
"UID" : "owner"
},
"topics" : ["bio"],
"users" : {
"mffUzP5wtBRhOHTVAhGctAUHsa72" : {
"credits" : -5
},
"qfh75zQbIfe8ooAWAB3rbcz4MBQ2" : {
"credits" : 5
}
}
}





And I want to programmatically add a child tasks-status to the users/UID for each user, and three more children to that one. Ideally, the tasks-status node will stay, and later requests will just add the unique TaskID node (mffUzP5wtBRhOHTVAhGctAUHsa721).



Example:



"users" : {
"mffUzP5wtBRhOHTVAhGctAUHsa72" : {
"credits" : -5,
"tasks-status" : {
"mffUzP5wtBRhOHTVAhGctAUHsa721" : {
"email": EMAIL,
"password": PASSWORD,
"status": STATUS
}
}
},


But for some reason, the set adds the data to the database, but it's highlighted red and automatically removed. In addition, I found that other child nodes of users/UID were also deleted. Also, just wanted to note that I'm not using this for authentication, I'm already familiar and using Firebase Auth.



I've read over the docs about set/update and can't seem to find an answer.



Here's a picture of what I mean, the red is the data that I want to add but is subsequently deleted





Any help would be greatly appreciated!










share|improve this question

























  • Do you also have a Cloud Functions database trigger that's doing something in response to your addition of data?

    – Doug Stevenson
    Dec 29 '18 at 19:05











  • @DougStevenson No I don't, but I think its because I'm including the write function in a for loop, and it's getting called at the same time, so it might be getting over written.

    – ezhong
    Jan 2 at 14:53














0












0








0








I'm trying to add data to an arbitrary path in Firebase real-time database with the Javascript SDK.



All rules are public, so permissions shouldn't be an issue. (read = true, write = true)



Here's my code so far, for the addition of data:



function writeUserData(user, taskId, email, password, status) {
firebase.database().ref('users/' + user + '/tasks-status/' + taskId).set({
email: email,
password : password,
status: status,
});
}


Current project architecture is like this:






{
"roles" : {
"UID" : "owner"
},
"topics" : ["bio"],
"users" : {
"mffUzP5wtBRhOHTVAhGctAUHsa72" : {
"credits" : -5
},
"qfh75zQbIfe8ooAWAB3rbcz4MBQ2" : {
"credits" : 5
}
}
}





And I want to programmatically add a child tasks-status to the users/UID for each user, and three more children to that one. Ideally, the tasks-status node will stay, and later requests will just add the unique TaskID node (mffUzP5wtBRhOHTVAhGctAUHsa721).



Example:



"users" : {
"mffUzP5wtBRhOHTVAhGctAUHsa72" : {
"credits" : -5,
"tasks-status" : {
"mffUzP5wtBRhOHTVAhGctAUHsa721" : {
"email": EMAIL,
"password": PASSWORD,
"status": STATUS
}
}
},


But for some reason, the set adds the data to the database, but it's highlighted red and automatically removed. In addition, I found that other child nodes of users/UID were also deleted. Also, just wanted to note that I'm not using this for authentication, I'm already familiar and using Firebase Auth.



I've read over the docs about set/update and can't seem to find an answer.



Here's a picture of what I mean, the red is the data that I want to add but is subsequently deleted





Any help would be greatly appreciated!










share|improve this question
















I'm trying to add data to an arbitrary path in Firebase real-time database with the Javascript SDK.



All rules are public, so permissions shouldn't be an issue. (read = true, write = true)



Here's my code so far, for the addition of data:



function writeUserData(user, taskId, email, password, status) {
firebase.database().ref('users/' + user + '/tasks-status/' + taskId).set({
email: email,
password : password,
status: status,
});
}


Current project architecture is like this:






{
"roles" : {
"UID" : "owner"
},
"topics" : ["bio"],
"users" : {
"mffUzP5wtBRhOHTVAhGctAUHsa72" : {
"credits" : -5
},
"qfh75zQbIfe8ooAWAB3rbcz4MBQ2" : {
"credits" : 5
}
}
}





And I want to programmatically add a child tasks-status to the users/UID for each user, and three more children to that one. Ideally, the tasks-status node will stay, and later requests will just add the unique TaskID node (mffUzP5wtBRhOHTVAhGctAUHsa721).



Example:



"users" : {
"mffUzP5wtBRhOHTVAhGctAUHsa72" : {
"credits" : -5,
"tasks-status" : {
"mffUzP5wtBRhOHTVAhGctAUHsa721" : {
"email": EMAIL,
"password": PASSWORD,
"status": STATUS
}
}
},


But for some reason, the set adds the data to the database, but it's highlighted red and automatically removed. In addition, I found that other child nodes of users/UID were also deleted. Also, just wanted to note that I'm not using this for authentication, I'm already familiar and using Firebase Auth.



I've read over the docs about set/update and can't seem to find an answer.



Here's a picture of what I mean, the red is the data that I want to add but is subsequently deleted





Any help would be greatly appreciated!






{
"roles" : {
"UID" : "owner"
},
"topics" : ["bio"],
"users" : {
"mffUzP5wtBRhOHTVAhGctAUHsa72" : {
"credits" : -5
},
"qfh75zQbIfe8ooAWAB3rbcz4MBQ2" : {
"credits" : 5
}
}
}





{
"roles" : {
"UID" : "owner"
},
"topics" : ["bio"],
"users" : {
"mffUzP5wtBRhOHTVAhGctAUHsa72" : {
"credits" : -5
},
"qfh75zQbIfe8ooAWAB3rbcz4MBQ2" : {
"credits" : 5
}
}
}






javascript firebase firebase-realtime-database






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 29 '18 at 16:07









Sumithran

8153822




8153822










asked Dec 29 '18 at 15:50









ezhongezhong

12




12













  • Do you also have a Cloud Functions database trigger that's doing something in response to your addition of data?

    – Doug Stevenson
    Dec 29 '18 at 19:05











  • @DougStevenson No I don't, but I think its because I'm including the write function in a for loop, and it's getting called at the same time, so it might be getting over written.

    – ezhong
    Jan 2 at 14:53



















  • Do you also have a Cloud Functions database trigger that's doing something in response to your addition of data?

    – Doug Stevenson
    Dec 29 '18 at 19:05











  • @DougStevenson No I don't, but I think its because I'm including the write function in a for loop, and it's getting called at the same time, so it might be getting over written.

    – ezhong
    Jan 2 at 14:53

















Do you also have a Cloud Functions database trigger that's doing something in response to your addition of data?

– Doug Stevenson
Dec 29 '18 at 19:05





Do you also have a Cloud Functions database trigger that's doing something in response to your addition of data?

– Doug Stevenson
Dec 29 '18 at 19:05













@DougStevenson No I don't, but I think its because I'm including the write function in a for loop, and it's getting called at the same time, so it might be getting over written.

– ezhong
Jan 2 at 14:53





@DougStevenson No I don't, but I think its because I'm including the write function in a for loop, and it's getting called at the same time, so it might be getting over written.

– ezhong
Jan 2 at 14:53












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53971009%2ffirebase-added-data-automatically-being-deleted%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53971009%2ffirebase-added-data-automatically-being-deleted%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







KO,v,ZOQZ,Xmc8R9 GKgR HJvhJEZFKyhHTk 7JLy,2gLD,U2NIgob03qBr,5KFkc zThy0TZ2kwK7C8hZvoe1JKQ5u,jm,UtyI20FbjF8
Bj lu74x51SR5TcZm 2MLBVQs22Mg4RMg9DLF5I3 PrFw,TawtjAyw,rUIalbPlUUZ1hRCo bMjVeuVhQOq

Popular posts from this blog

Monofisismo

Angular Downloading a file using contenturl with Basic Authentication

Olmecas