How to properly Store and structure my data in Mongo db - database

I am having one problem while working on Mongo db with an Node js project,
I am creating a Meeting Scheduler project where a user(admin) can create an account and register his company on our project and that company has 1000 members and few teams and members can be a part of multiple teams and some members can be alone not in any team
and their are multiple admins with different access
and their is also an data of meetings
Their are Personal meetings of a member with one or multiple members
and also their are Team meetings
Their is also an data of messages
A user can send the message to his Team
Their is also an TODO list of the particulars Teams
So what I tried is storing data in the only one User Model where it has every data about his Team, Personal and Team Meetings and Team Messages I have to store in every User's Collection
The issue in this is that its I know its not at all the Best and Optimized approach to solve this problem and this will consume a lot of memory
Can Anyone please suggest the best way to Store this data like how to store data in different Models/Schemas and how to link them for the best performace and ease to access and perform CRUD operations

Related

Structure data in Firebase Firestore

I need help understanding the best approach to structure my firestore data.
I come from traditional SQL background and have a little bit of nosql mongodb background as well. I am building a small football prediction app and here is the user flow:
User:
User registers/signs in
They can pick a contest to join
Enter their predictions every week
Admin:
Create contests and add/edit games to contest every week (an api will fetch all the data like fixtures and results)
Set a deadline for when users can enter their last prediction for the game week
Other:
Leaderboard
Now I did create a diagram on how I would traditionally structure this data but it would be nice if someone can exaplain to me the simplest approach to structuring such an app in Firestore
It looks reasonable but I would be concerned about storing the passwords in Firestore DB. Firestore should not ideally be concerned with authentication. Check Firebase Authentication for different auth options with Firebase. You'll probably end up only having to store the user ID as other information is in the User object.
Also check out Supported data types. You probably want to change varchar(x) to (UTF-8) string or byte types. Moreover, there is a reference type so you could reference the actual user document from the other tables.
One main design will be whether to use nested collections (Hierarchical Data).
You might be able to nest score under competitions.

Structuring data in firestore and referencing users

I'm building a React/Firebase app, and I need to structure my data so that many users can use the app with proper performance and security.
Here's the outline:
I've got the standard firebase users (for authentication), and an extra users collection to store extra data about each user (address, etc).
Every user should have has a bunch of tasks, only accessible/viewable by the user himself. Tasks cannot be shared between users.
Besides tasks, there can be many other types of documents that are user-specific. For instance, projects. Different projects can contain the same tasks, but the projects are user-specific.
Should I store all tasks in a tasks collection, all projects in a projects collection, then referencing which user the task/projects belongs to in every task/project document? In such case, do I simply store the uid of each user in the document?
Or should I have a collection tasks, a collection projects, with a sub-collection for each user?
The main concerns are performance and security, I have no idea how firestore compares to classic relational databases as far as performance goes.

Salesforce Objects available in Social Tables

My question has to do with the Salesforce integration in Social Tables and is two-fold: 1. Am I correct that only objects belonging to Contacts can be imported to Social Tables? 2. Is further integration under development?
To clarify, at present it appears that Social Tables pulls contacts from Campaigns, but does not pull other campaign data - only data stored in Contact records.
To really make use of the Salesforce integration, we'd like to import event data to Social Tables fields (e.g. Table #, Seat # etc). (Our use case is a seated fundraising breakfast.) Intuitively, that would mean Campaign Member in Salesforce would need to be imported to Social Tables along with Contacts (event-specific data can't be stored that in Contact records, since the guest data and data types would vary for different events).
Similarly, it would be great to have the option to import only the contacts in a campaign that have a specific status or "Attending?" value. I know it's possible to map Salesforce fields to event-specific fields in Social Tables, so maybe I'm missing something...thanks in advance!
Let me try to answer those for you.
Am I correct that only objects belonging to Contacts can be imported to Social Tables?
This is almost correct, for a given CampaignMember of a Campaign we are currently pulling all Lead or Contact fields (depending on the type of the CampaignMember). This does not include CampaignMember fields.
Is further integration under development?
My team is responsible for Check-In and although our focus is currently not on adding SF Integration features, we weigh customer feedback very heavily when revisiting our roadmap. You make a very valid point with including CampaignMember fields with the import and I will communicate this to our product team so they can handle accordingly.
Importing a subset of members is another great feature request that we will note. Once we have CampaignMember fields included you could accomplish this by importing all members then selecting users with unwanted statuses and deleting. Not the best but will work.
Thanks for reaching out with the fantastic feedback and hope this helps answer your questions!

Database Design - Dashboard

I'm trying to design database schema for a web app that serves as a dashboard.
There can be any number of Dashboards (User can create new dashboard)
Each Dashboard is associated with Teams (About 10-25 teams per dashboard)
Each Teams has Members (About 10 members per team)
Each Member has a name, role, email
Every Team submits weekly reports through a form (About 12 questions. All questions are same for every team except one question)
The Form responses are stored in the database.
Based on the weekly form responses, the warnings are displayed on the Dashboard (web app). There are fields like Teams issues, Number of meetings missed by a member, etc
What I've done so far
Is this the correct way to design the database? Can this be improved? I'm using Django to create the web app and SQLite3 database.
It looks like you are off to a good start. Based on your business rules that you listed, you might want expand your design based on #7. For example, you mention that team's attend meetings, yet there is no branch for this action by member.
One other area that I see for improvement is #5. Although at the start you may think there are at most 12 questions, your database model should be built to accommodate future requirements: your form responses should be composed from a minimum of four tables (Survey, Question, SurveyQuestion, SurveyResponse).

Sync google contacts by group to a limited number of users

I am trying to build an open-source python code hosted at GAE to sync contacts by group to a limited number of users. In a web interface users will be able to pick their group and whom it will be synced with.
I understand there is a lot of applications on market place withe the same functionality, but my organization is concerned about those provides selling contacts to 3rd parties. We are a non-profit organization, so the code could be hosted at google project or github for community contribution.
(sorry for the long intro)
How is the best way to start? is there tutorial available with similar functionality that I can expand?
What is the best way to compare two Contact kind elements? To see if they need to be sync.
Is there a last update on the Contact kind elements? In case I want to implement a last update wins?
thanks!
I don't know of any tutorials for syncing and comparing contacts specifically, but there is a getting started guide for the Google Contacts API at https://developers.google.com/google-apps/contacts/v3/.
The contacts are sent as XML blobs, so you could compare two contacts by parsing them and looking at the individual elements within them. I don't think there's a better way to do this but there are libraries to handle it for you.
There is a last updated field sent as part of the contacts when retrieving them with the API. It is an XML element labeled <updated>.
how are you getting different user's contacts feeds?
i tried to save the tokens in the datastore when the
users grant the access, but when i get the token back
from datastore for 2 users at a time, after an hour
when the token expires,
all tokens start working like the current users token
and i can only get current users contacts.
token = Get_Shared_User_Token(user_email)
contact_client = gdata.contacts.client.ContactsClient(source=USER_AGENT)
authorized_client = token.authorize(contact_client)
contacts_feed = authorized_client.GetContacts(q = query)
can you please tell how one can get any user's contacts?

Resources