These are chat archives for Automattic/mongoose

29th
Apr 2018
panigrah
@panigrah
Apr 29 2018 02:24

hi, I am looking for the best way to filter a set of documents that are referenced in two others. e.g. I have a Property that has Owners and in a Club. Owner and Club and Property are all different documents. They are all many-to-many relationships. The models are

  • Property
  • Owner
  • Club
  • PropertyOwner (maps Owners to Property has reference to both)
  • ClubProperty (maps Club to Property has reference to both)

I need to get a list of all Properties that belong to one or more Owners and one or more Clubs. Whats the most efficient way to do this when there are 1000s of properties possible.