MongoDB, unlike SQL databases, does not support the conventional stored procedures. However, you can create and store functions on the database, and then call them within a query or a script when required. This approach is somewhat analogous to a stored procedure.
Here is an example of how you can do it:
Step 1: Create the function
```
db.system.js.save(
{
_id: “myFunction”,
value: function(x, y){
// Your logic here
return x + y;
}
}
)
```
Step 2: Call the function
```
db.eval(“myFunction(4,3)”)
```
Please note that making excessive use of server-side Javascript and functions can impact MongoDB server performance because Javascript execution in MongoDB is single-threaded. It also opens up potential security holes. Furthermore, this feature is deprecated since version 4.4.
Therefore, it’s generally recommended to maintain business logic in the application layer, not in the database layer.