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)
Related
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:
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, }) })
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:
Predict next auto-inserted row id (SQLite)
(11 answers)
Closed 6 years ago.
I have a database in SQLite that I'll be using to store restaurants information for a website.
The website will allow users to insert new restaurants in the dabase (through php).
My question is, given that each row in a table in the database has its id attribute (which is the primary key), how can I know what id should the next item I'm going to store in the database have?
If the last item added to the database has the id 50, then the next restaurant a user tries to add should have the id 51, but how can I have access to this?
Here's my SQLite Restaurant table:
CREATE TABLE Restaurant (
id NUMBER PRIMARY KEY NOT NULL,
name NVARCHAR2(20) NOT NULL,
description NVARCHAR2(20),
address NVARCHAR2(20) NOT NULL,
priceRange NUMBER NOT NULL REFERENCES PriceRange(id) ON DELETE SET NULL ON UPDATE CASCADE
);
Thanks in advance!
Since you've tagged the question with php, you should be able to use SQLite3::lastInsertRowID().
Alternatively, a pure SQLite solution is the last_insert_rowid() function.