MongoDB: get documents by tags

后端 未结 3 677
执笔经年
执笔经年 2020-12-15 07:25

I\'ve got documents containing tags array. I want to provide tags based recommendations on site, so I need to get documents containing same tags + documents tha

3条回答
  •  天命终不由人
    2020-12-15 08:12

    The rephrased question is:

    Suppose if job postings have search tags attached like

    Job Postings

    [{_id : ObjectId(1249999493),tags : ['Location1', 'SkillSet1', 'SkillSet2', 'Someother1', 'Someother2']},
     {_id : ObjectId(1249999494),tags : ['Location3', 'SkillSet1', 'SkillSet0', 'Someother4', 'Someother3']}]
    

    Now, he wants the records having tags ['Location1','SkillSet1', 'SkillSet0']

    And the selected docs having more keywords from the query should come first. Less keywords matching should come last. So, that one can get more suitable job posting for the search query.

    Am I sensible or do I need to re-phrase ?

提交回复
热议问题