Search code examples
meteormeteor-autoform

What is the best way to sandbox collections in meteor?


I want to isolate each user's data from all other users. What is the best way to keep a user viewing and modifying only her stuff? My approach has been to

  1. Add a userId field on every collection
  2. Configure every published collection to filter on userId.
  3. Use simple-schema with collections2 and add autoValue: function(d) { return this.userId } on the userId field for each schema to force the userId during validation.

Is this a good and correct approach? What is best practice?


Solution

  • @dk. this sounds like a good approach to me and is considered best practice as well (as of my experience with meteor).