This question already has answers here:
firestore update() function cast updated data to map
(1 answer)
how to edit an array element present in firestore [duplicate]
(2 answers)
Firestore Update single item in an array field
(2 answers)
Is there any way to update a specific index from the array in Firestore
(3 answers)
Closed 2 years ago.
I search to update 1 data who is in my last array, my code just add this data in firestore but I don't com in my last array.This is my database
I want to update isPay at true.
On my database futurOrder is array and need to enter in my last index of futurOrder and update isPay at true
firebase.getUserOrder().doc(userSession.uid).update({ isPay : true })
Else I have try this but with this code I add new index I don't update last index
firebase.getUserOrder().doc(userSession.uid).update({ futurOrder: firebase.addInArray().arrayUnion({ isPay: true, }) })
Related
This question already has answers here:
How to use array-contains operator with an array of objects in Firestore?
(2 answers)
Firestore to query by an array's field value
(3 answers)
Firestore - query where filter of object in array field
(1 answer)
Closed 4 months ago.
I created a Firestore database. I am learning.
How can I access a map into a map, the image help me to explain my doubt.
I can do a query like this in this case scenario:
->recipes
-->idRecipe
--->ingredients
---->0
----->rice
---->1
----->meat
Query query = recipesRef.whereArrayContains("ingredients", "rice");
But how I can do in this case scenario?
Firestore structure:
How can I find the values of -> ingredient (name:rice)
This question already has answers here:
How to perform compound queries with logical OR in Cloud Firestore?
(12 answers)
OR Logical operation in Firestore Query
(1 answer)
Closed 2 years ago.
How can i do a simple query that looks like that in sql but with cloud firestore?
Is there a way without using a composite index ?
"Select column3 From TableA Where column1 == A OR column2 == A"
This question already has answers here:
Firestore "Invalid query" - Am I using Indexing wrong?
(1 answer)
Firestore compound query with <= & >=
(1 answer)
Firestore | Why do all where filters have to be on the same field?
(2 answers)
Closed 2 years ago.
How do I get the highest score from within a date range in a single request on firebase firestore?
await Firestore.collection(CollectionName.post)
.orderBy("score")
.where("publishedAt", ">", Firebase.firestore.Timestamp.fromDate(GetDateAndMinus(24)))
.where("publishedAt", "<=", Firebase.firestore.Timestamp.now())
.get(),
});
Invalid query. You have a where filter with an inequality (<, <=, >,
or >=) on field 'publishedAt' and so you must also use 'publishedAt'
as your first orderBy(), but your first orderBy() is on field 'score'
instead.
This question already has answers here:
Create an empty child record in Firebase
(2 answers)
Closed 4 years ago.
If I want to create keys that have no values, just to have list of certain data for each user in my case.
So it should look like something like that:
database
|
user_id6
|____data1
|____data2
In my example, each user should have a list of data, where the data is they key. Is it possible? Or I should just create a key with some arbitrary value for example:
database
|
user_id6
|____data1: true
|____data2: true
Nodes in Realtime Database can't have "no value", otherwise they would cease to exist. Assigning some boolean value, as you're showing, is one way to represent your data.
This question already has answers here:
Order by field with SQLite
(1 answer)
SQLite and custom order by
(3 answers)
Closed 5 years ago.
I'd like to make a query in SQLite that uses a list of contact IDs and is sorted based on the order position of those IDs in the list.
For example:
select * from Contact where Contact.ID in (1,3,2,4)
// then order by (1,3,2,4)
Is there any equivalent construct in SQLite like "ORDER BY FIELD" in mysql?
e.g.
select * from Contact where Contact.ID in (1,3,2,4)
order by field (Contact.ID,1,3,2,4)
that will also support if given a long list of IDs, not as short as an example above.
Thanks!
SELECT *
FROM CONTACT
WHERE CONTACT.ID IN (1,2,3,4)
ORDER BY
CASE ID
WHEN 4 THEN 1
WHEN 3 THEN 0
WHEN 2 THEN 2
WHEN 1 THEN 3
END
returns in order (3,4,2,1)
Is this what you want?