Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have a users object, in that I am trying to update a specific node(status) by using the firebase update(payload) method. But when I try to do that, instead of updating the value in the parent node, it creates a new child node(duplicate node) with the value being updated there.
let firebaseApp = firebase.initializeApp(firebaseConfig);
let uniqueID = "OEHCrSnKFrd87JDivvA0sLMnj8u1"
firebaseApp.database()ref("users/" + uniqueID).update({
status: false
})
Duplicate node image
On .update() you have to specify the path for the key.
try the following:
let firebaseApp = firebase.initializeApp(firebaseConfig);
let uniqueID = "OEHCrSnKFrd87JDivvA0sLMnj8u1"
let updates = {};
updates["/status"] = false;
firebaseApp.database()ref("users/" + uniqueID).update(updates)
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
Hi I try to call some data using API but it shows error message of "invalid key". But In the function I didn't figure out where I can input my key. The code is shown below:
sahie_years <- getCensus(
name = "timeseries/healthins/sahie",
vars = c("NAME", "PCTUI_PT"),
region = "state:01",
time = "from 2006 to 2018")
head(sahie_years)
Can anybody have some ideas?
See documentation here for setting up your API key.
You need to sign up for an API key here.
Once you've done that you can either specify your API key by setting an environment variable using Sys.setenv(CENSUS_KEY="YOUR_CENSUS_KEY_GOES_HERE"), or
just set it directly in your getCensus call by adding the argument key = "YOUR_CENSUS_KEY_GOES_HERE".
For API keys in general, it is often easiest to set them in a .Renviron file, which will make them available in each session using Sys.getenv.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
Hi guys how can I request all the data form this kind of DB structure?
I tried this but it's not working:
var recentPostsRef = firebase.database().ref('/store');
You are on the right track, but missing the retrieval part where .then() is used with a callback:
var recentPostsRef = firebase.database().ref('/store');
recentPostsRef.once('value').then(snapshot => {
// snapshot.val() is the dictionary with all your keys/values from the '/store' path
this.setState({ stores: snapshot.val() })
})
The firebase.database.Reference documentation has a lot of good examples and explanations that can help.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
{
"likes" : {
"-K_4PuiqVo6BsIsL0tMD" : {//post reference id
"-K_4Pv_JXQHW_LoDNUJY" : {//'like' id(randomely generated)
"id" : "TYS111088",
"photoUrl" : "https://web.smm:8081/Emp_Images/Upload/Emp_Photo/t_TYS111088-c22cbe899f.JPG",
"username" : "Anubhav"
},
"-K_4QP-lGvH9K2cljSIh" : {//'like' id(randomely generated)
"id" : "TYS111088",
"photoUrl" : "https://web.smm:8081/t_TYS111088-c22cbe899f.JPG",
"username" : "Anubhav"
}
}
}
I want to delete particular 'like'id node(with details),on click of dislike button. I am using android app.
We don't know the platform but the answer is very similar
let ref = myRootRef.child("likes")
.child("-K_4Fbj0wBmZf3_l-uXe")
.child("-K_4FdjaJgPoR0EGwexB")
ref.removeValue()
you can also delete data by setting using ref.setValue and setting it to nil.
I think that you have structured your data wrongly. You want to use on("child_added") on "likes". Once you have all childs,
you want to delete a child via user input (e.g. you have a delete button with the referense to the current key)
When storing: ref("likes").push()
When retrieving: ref("likes").on("child_added")
In the data viewer (what you're looking at) you can hover over a node and you'll have the ability to add a new child (green + button) or delete the node (red X button).
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
How to try to use ban message from device if The message is same .
I want to get message from device like "OK" While it is connect . Then it will respond to me message "OK" . Device permenently send me message "OK" after send new message. How can I avoid this message.
var list = new List<string>();
...
// in the loop or other repeating code
list.Add("OK");
...
// at the end of code
var summary = string.Join(". ", list.ToArray());
gotNewmesage(summary);
Istead of showing a message directly, collect all messages and show them at the end of the action/method.
Example:
var list = new List<string>();
...
// in the loop or other repeating code
list.Add("OK");
...
// at the end of code
var summary = string.Join(". ", list.ToArray());
gotNewmesage(summary);
If you want to avoid duplicates, check it before adding a message, for example
if (!list.Contains("OK"))
list.Add("OK");
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
getting error in my linq query code below:
var imgfoldernme=from ct in db.ShopAssignDetails.OrderByDescending(m=>m.Id).Where(c=>c.CompanyId.ToString()==sh.Cid.ToString() && c.BrandId.ToString()==sh.BId.ToString()).ToList();
Try, you didn't write exact error message so there may be more errors than what we see, this:
var imgfoldernme = db.ShopAssignDetails
.OrderByDescending(m=>m.Id)
.Where(c => c.CompanyId.ToString() == sh.Cid.ToString() && c.BrandId.ToString() == sh.BId.ToString())
.ToList();
Problem is you're trying to use both syntax for LINQ queries. You started to write a query expression (from ... in ...) but actually you didn't provide anything else (calls to OrderByDescending and Where will feed from data source). For a query expression you have at least to provide a select statement too.
you are using linq query syntax and lambda expression at once
use this
var imgfoldernme = db.ShopAssignDetails
.OrderByDescending(m=>m.Id)
.Where(c => c.CompanyId.ToString() == sh.Cid.ToString() && c.BrandId.ToString() == sh.BId.ToString())
.ToList();