What would be a better many-to-many solution in MongoDB of the relationship would number 1000000?
You can add a third collection, named person_group, being described in that blog picture.

db.person_groups.insert({
  "_id": ObjectId("5e54ed9f48dc5922c0094a42"),
  "groupId": ObjectId("4e54ed9f48dc5922c0094a43"),
  "personId": ObjectId("4e54ed9f48dc5922c0094a44")
});