Ensure MongoDB index in deploy or build hook

Hey there,
I’m looking for a way to ensure a MongoDB index exists when the app is deployed.

Is there a way to do so in the deploy or build hook?
What would it look like?

Thanks!