-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
db Modeling and db related discussion. #42
Comments
Is that efficient.
|
But then repos array can have thousands of entry for each stargazers(username). Question: - How are quering GitHub at the moment. I know that we are querying each stargazer but is there any sort or filter while doing API call to Github? In NoSQL you design database based on Queries you will be doing. |
No, there is no real query filter at the moment. In case the user selects a language, the array filter function is used, but it's applied once you query all projects starred by each user.
When a language is selected, I tried to query just the projects developed with thath language bit It seems like there is no language parameter at Github API. |
Ok let just start by writing down queries we think we will be doing to DB.
anything else you guys can think of..... |
@alejandronanez What do you think about this? |
1 & 2. Have you tried querying the graphql endpoint instead of the rest endpoints? GQL helps us to 'filter' what data we get back from the server. |
@alejandronanez good shout about GQL, don't know how to do that. 😉 but it will be fun to learn. 😄 I think instead of creating an array of repos in repositorySchema = new Schema({
name: curiosity
:
language:'javascript',
githubLogins: [asiyani,alejandronanez,mubaris....],
}); In this way we don't have to search username() collection at all, we can just query repository collection. Of course, this will only work if githubLogin are unique and I am sure they are. # following should give me all repos started by 'asiyani' from DB.
Repository.find({ githubLogins: { "$in" : ["asiyani"]} }, ...);
# following should give me all repos started by 'asiyani' & language=javascript from DB.
Repository.find({ githubLogins: { "$in" : ["asiyani"]} }, language:'javascript'); If user do need info about stargazers then we can query that separtly.
but most of the time we will be quering Repository collection ratherthen username collection. In this way there want be any application level joints.
Let me know what you guys think. |
I like this new way of storing repository details. Easy to get details. |
@asiyani I like this new approach too. I have experience with GQL, let me know if you hit any roadblock or something. |
Good then we will go with this scheme. |
There are few topics we need to discuss regarding the database.
I think
userSchema & repositorySchema is fine but usernameSchema got lots of stuff which we might not need. like location, bio
This one depends on the query we will be running on DB and amount of data. If I am right at the moment we are querying usernames to get repository. in that case......
Problem with this is some username like 'tj' got 1.7k starred repositories! thats to many Ids to put in array.
Other solution.
because we have limited number of usernames we can do this....
Problem is it will be dificult to just query repository based on usernames..
Don't know 😖
Lets discuss answers for all 3 questions or any other questions related to DB.
The text was updated successfully, but these errors were encountered: