MongoDB Stored Procedure Equivalent

You could use Triggers and Functions on the cloud with MongoDB Stitch.


NOTE that according to the reference:

Do not store application logic in the database. There are performance limitations to running JavaScript inside of MongoDB. Application code also is typically most effective when it shares version control with the application itself.

So there is not any equivalent for stored procedure in mongodb.


The closest thing to an equivalent of a stored procedure in mongodb is stored javascript. A good introduction to stored javascript is available in this article on Mike Dirolf's blog.