convert sql query into nosql query for firestore database
I have the following two SQL queries and I'd like to know how make it work them into NoSQL databases. I am not so good in NoSQL queries. Could you please help me with it?
Here are my queries:
First SQL query
const myAge = 20 ;
const weight : 60;
const ourPoints = 1000;
SELECT a.* from myTable a , users u
WHERE a.userID = u.id
AND a.age >= myAge OR age < 49
AND a.weight <= weight
AND ourPoints - u.points =< 500
AND u.married IS NOT EGUAL TO 0
and here is the schema of my firebase collections:
myTable : {
{
id : 2,
userID : 78,
age : 78,
weight : 64,
...
},
{
id : 3,
userID : 18,
age : 18,
weight : 48,
...
}
}
users : {
{
id : 1,
name : 'david',
married : 1
points : 100
},
{
id : 2,
name : 'alex',
married : 0,
points : 290
}
...
}
Second SQL query
SELECT a.* FROM table1 a , table2 x WHERE a.uID = x.id GROUP BY myDay
and the schema of my collections :
table1 : {
{ id : 89,
timestamps : 12799035,
uID : 10,
myDay : 111111,
},
{
id : 90,
timestamps : 61782990,
uID : 13,
myDay : 111111,
...
},
{
id : 90,
timestamps : 61782990,
uID : 13,
myDay : 111111,
...
},
{
id : 90,
timestamps : 61782990,
uID : 13,
myDay : 22222222,
...
}
}
thanks a lot
from Recent Questions - Stack Overflow https://ift.tt/3nu7Z9b
https://ift.tt/eA8V8J
Comments
Post a Comment