DiscoverMeteor / book

17 stars 0 forks source link

Enforce unique URLs with Unique Index on the server? #331

Open Yaakov-Belch opened 10 years ago

Yaakov-Belch commented 10 years ago

Microscope tries to prevent duplicate URLs by checking the URL of a newly created post against the URLs already submitted to the data base. This technique is not fault-proof:

It seems to me that the correct approach is to Create a Unique MongoDB Index on the server and to just handle the exceptions thrown by invalid operations. I haven't tried this myself, though.

tmeasday commented 10 years ago

Yes. We should probably mention indices somewhere in the book too.