Matching users Firestore db model










0















I am developing a mobile app in flutter to help people connect with DIY experts.



The app will connect people who need advice to people who are expert, then let them chat in 1:1 messaging. As example, person A want advice on plumbing, so the app connect him to person B, who know how to plumbing.



My database model is use Firestore to store user details and FCM tokens. Cloud functions to send notifications to all expert FCM tokens (to notify them when non-expert need help).



Here my model so far:



  1. Firestore: Store 2 groups users: non-expert and expert.

  2. When non-expert in app taps ‘I need help!’, flag non-expert’s field in database ’needhelp’ to set to true.

  3. Firebase Cloud function listen to change, and send FCM to all expert FCM tokens in database.

  4. ?? When one expert in app tap ‘I can help!’, create new chat document in db ??

  5. Firestore: Create new Messages document, store messages etc.

My question is step 4: how to match and connect expert and non-expert in new 1:1 chat when expert tap ‘I can help’ in client app. On tap, should expert client app set new value in document in Firestore? What document? What db model for this?



Similar apps are dating apps e.g. Tinder. Fun question: What would Tinder Firestore look like? :)










share|improve this question
























  • So you basically need a database schema for your app, right?

    – Alex Mamo
    Nov 15 '18 at 9:53











  • Yes basically @AlexMamo. I have watch you youtube videos!! But I no find how to match users at step 4 above.

    – FlutterFirebase
    Nov 15 '18 at 14:48











  • You can find answers for all your questions in my tutorials. For a one to one chat app, please see this Firestore chat tutorial.

    – Alex Mamo
    Nov 15 '18 at 16:04












  • @AlexMamo I have watch all you videos, but not answer my question. You schema work where you always know exactly who you will connect with. In you video: 'Second User' / First Random User' / 'Second Random User'. You schema work for normal chat app because always know who need connect to. However in my app we never know which users we will be connecting before there is match. We don't know who non-expert will connect to. We don't even know if non-expert will find match. So my database model must be different.

    – FlutterFirebase
    Nov 16 '18 at 16:52











  • Once you change that property to available, it means that you know the person you are chating with. So basically the whole problem is reduces the schema in my video.

    – Alex Mamo
    Nov 16 '18 at 16:56















0















I am developing a mobile app in flutter to help people connect with DIY experts.



The app will connect people who need advice to people who are expert, then let them chat in 1:1 messaging. As example, person A want advice on plumbing, so the app connect him to person B, who know how to plumbing.



My database model is use Firestore to store user details and FCM tokens. Cloud functions to send notifications to all expert FCM tokens (to notify them when non-expert need help).



Here my model so far:



  1. Firestore: Store 2 groups users: non-expert and expert.

  2. When non-expert in app taps ‘I need help!’, flag non-expert’s field in database ’needhelp’ to set to true.

  3. Firebase Cloud function listen to change, and send FCM to all expert FCM tokens in database.

  4. ?? When one expert in app tap ‘I can help!’, create new chat document in db ??

  5. Firestore: Create new Messages document, store messages etc.

My question is step 4: how to match and connect expert and non-expert in new 1:1 chat when expert tap ‘I can help’ in client app. On tap, should expert client app set new value in document in Firestore? What document? What db model for this?



Similar apps are dating apps e.g. Tinder. Fun question: What would Tinder Firestore look like? :)










share|improve this question
























  • So you basically need a database schema for your app, right?

    – Alex Mamo
    Nov 15 '18 at 9:53











  • Yes basically @AlexMamo. I have watch you youtube videos!! But I no find how to match users at step 4 above.

    – FlutterFirebase
    Nov 15 '18 at 14:48











  • You can find answers for all your questions in my tutorials. For a one to one chat app, please see this Firestore chat tutorial.

    – Alex Mamo
    Nov 15 '18 at 16:04












  • @AlexMamo I have watch all you videos, but not answer my question. You schema work where you always know exactly who you will connect with. In you video: 'Second User' / First Random User' / 'Second Random User'. You schema work for normal chat app because always know who need connect to. However in my app we never know which users we will be connecting before there is match. We don't know who non-expert will connect to. We don't even know if non-expert will find match. So my database model must be different.

    – FlutterFirebase
    Nov 16 '18 at 16:52











  • Once you change that property to available, it means that you know the person you are chating with. So basically the whole problem is reduces the schema in my video.

    – Alex Mamo
    Nov 16 '18 at 16:56













0












0








0


1






I am developing a mobile app in flutter to help people connect with DIY experts.



The app will connect people who need advice to people who are expert, then let them chat in 1:1 messaging. As example, person A want advice on plumbing, so the app connect him to person B, who know how to plumbing.



My database model is use Firestore to store user details and FCM tokens. Cloud functions to send notifications to all expert FCM tokens (to notify them when non-expert need help).



Here my model so far:



  1. Firestore: Store 2 groups users: non-expert and expert.

  2. When non-expert in app taps ‘I need help!’, flag non-expert’s field in database ’needhelp’ to set to true.

  3. Firebase Cloud function listen to change, and send FCM to all expert FCM tokens in database.

  4. ?? When one expert in app tap ‘I can help!’, create new chat document in db ??

  5. Firestore: Create new Messages document, store messages etc.

My question is step 4: how to match and connect expert and non-expert in new 1:1 chat when expert tap ‘I can help’ in client app. On tap, should expert client app set new value in document in Firestore? What document? What db model for this?



Similar apps are dating apps e.g. Tinder. Fun question: What would Tinder Firestore look like? :)










share|improve this question
















I am developing a mobile app in flutter to help people connect with DIY experts.



The app will connect people who need advice to people who are expert, then let them chat in 1:1 messaging. As example, person A want advice on plumbing, so the app connect him to person B, who know how to plumbing.



My database model is use Firestore to store user details and FCM tokens. Cloud functions to send notifications to all expert FCM tokens (to notify them when non-expert need help).



Here my model so far:



  1. Firestore: Store 2 groups users: non-expert and expert.

  2. When non-expert in app taps ‘I need help!’, flag non-expert’s field in database ’needhelp’ to set to true.

  3. Firebase Cloud function listen to change, and send FCM to all expert FCM tokens in database.

  4. ?? When one expert in app tap ‘I can help!’, create new chat document in db ??

  5. Firestore: Create new Messages document, store messages etc.

My question is step 4: how to match and connect expert and non-expert in new 1:1 chat when expert tap ‘I can help’ in client app. On tap, should expert client app set new value in document in Firestore? What document? What db model for this?



Similar apps are dating apps e.g. Tinder. Fun question: What would Tinder Firestore look like? :)







firebase nosql flutter google-cloud-firestore google-cloud-functions






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 6:43









Billal Begueradj

5,953132843




5,953132843










asked Nov 14 '18 at 21:24









FlutterFirebaseFlutterFirebase

627




627












  • So you basically need a database schema for your app, right?

    – Alex Mamo
    Nov 15 '18 at 9:53











  • Yes basically @AlexMamo. I have watch you youtube videos!! But I no find how to match users at step 4 above.

    – FlutterFirebase
    Nov 15 '18 at 14:48











  • You can find answers for all your questions in my tutorials. For a one to one chat app, please see this Firestore chat tutorial.

    – Alex Mamo
    Nov 15 '18 at 16:04












  • @AlexMamo I have watch all you videos, but not answer my question. You schema work where you always know exactly who you will connect with. In you video: 'Second User' / First Random User' / 'Second Random User'. You schema work for normal chat app because always know who need connect to. However in my app we never know which users we will be connecting before there is match. We don't know who non-expert will connect to. We don't even know if non-expert will find match. So my database model must be different.

    – FlutterFirebase
    Nov 16 '18 at 16:52











  • Once you change that property to available, it means that you know the person you are chating with. So basically the whole problem is reduces the schema in my video.

    – Alex Mamo
    Nov 16 '18 at 16:56

















  • So you basically need a database schema for your app, right?

    – Alex Mamo
    Nov 15 '18 at 9:53











  • Yes basically @AlexMamo. I have watch you youtube videos!! But I no find how to match users at step 4 above.

    – FlutterFirebase
    Nov 15 '18 at 14:48











  • You can find answers for all your questions in my tutorials. For a one to one chat app, please see this Firestore chat tutorial.

    – Alex Mamo
    Nov 15 '18 at 16:04












  • @AlexMamo I have watch all you videos, but not answer my question. You schema work where you always know exactly who you will connect with. In you video: 'Second User' / First Random User' / 'Second Random User'. You schema work for normal chat app because always know who need connect to. However in my app we never know which users we will be connecting before there is match. We don't know who non-expert will connect to. We don't even know if non-expert will find match. So my database model must be different.

    – FlutterFirebase
    Nov 16 '18 at 16:52











  • Once you change that property to available, it means that you know the person you are chating with. So basically the whole problem is reduces the schema in my video.

    – Alex Mamo
    Nov 16 '18 at 16:56
















So you basically need a database schema for your app, right?

– Alex Mamo
Nov 15 '18 at 9:53





So you basically need a database schema for your app, right?

– Alex Mamo
Nov 15 '18 at 9:53













Yes basically @AlexMamo. I have watch you youtube videos!! But I no find how to match users at step 4 above.

– FlutterFirebase
Nov 15 '18 at 14:48





Yes basically @AlexMamo. I have watch you youtube videos!! But I no find how to match users at step 4 above.

– FlutterFirebase
Nov 15 '18 at 14:48













You can find answers for all your questions in my tutorials. For a one to one chat app, please see this Firestore chat tutorial.

– Alex Mamo
Nov 15 '18 at 16:04






You can find answers for all your questions in my tutorials. For a one to one chat app, please see this Firestore chat tutorial.

– Alex Mamo
Nov 15 '18 at 16:04














@AlexMamo I have watch all you videos, but not answer my question. You schema work where you always know exactly who you will connect with. In you video: 'Second User' / First Random User' / 'Second Random User'. You schema work for normal chat app because always know who need connect to. However in my app we never know which users we will be connecting before there is match. We don't know who non-expert will connect to. We don't even know if non-expert will find match. So my database model must be different.

– FlutterFirebase
Nov 16 '18 at 16:52





@AlexMamo I have watch all you videos, but not answer my question. You schema work where you always know exactly who you will connect with. In you video: 'Second User' / First Random User' / 'Second Random User'. You schema work for normal chat app because always know who need connect to. However in my app we never know which users we will be connecting before there is match. We don't know who non-expert will connect to. We don't even know if non-expert will find match. So my database model must be different.

– FlutterFirebase
Nov 16 '18 at 16:52













Once you change that property to available, it means that you know the person you are chating with. So basically the whole problem is reduces the schema in my video.

– Alex Mamo
Nov 16 '18 at 16:56





Once you change that property to available, it means that you know the person you are chating with. So basically the whole problem is reduces the schema in my video.

– Alex Mamo
Nov 16 '18 at 16:56












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53308950%2fmatching-users-firestore-db-model%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53308950%2fmatching-users-firestore-db-model%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

Museum of Modern and Contemporary Art of Trento and Rovereto