How to structure and query data from Firebase Cloud Firestore in a many to many relationship?

I have Companies and Contractors. A Contractor can work for more than one Company and a Company can have multiple Contractors. This is a straightforward many to many relationship. I want to be able to answer the questions about Companies and Contractors:

Given a Company, who are the current Contractors.
Given a Contractor what Companies are they working for.
What is the right way for structuring the data within Cloud Firestore?