The one-time equivalent of a stored MongoDB procedure

I have a large CSV file containing a list of stores in which one of the fields is ZipCode. I have a separate MongoDB database called ZipCodes, which stores the latitude and longitude for any given zip code.

In SQL Server, I would execute a stored procedure called InsertStore, which would search the ZipCodes table to get the appropriate latitude and longitude and paste the data into the store table.

Something similar to the concept of stored procedures in MongoDB for this? Basically, for each insert I need to find the latitude and longitude for this store and save it as well.

I'm not too familiar with the Map / Reduce concept, but will it make a difference here? Thank!

+64
stored-procedures mongodb mapreduce geolocation
06 Oct '10 at 19:09
source share
2 answers

The closest thing to mongodb's stored procedure equivalent is javascript. A good introduction to saved javascript can be found in this blog post by Mike Dyrololf.

+96
Oct. 11 2018-10-10
source share
β€” -

NOTE that according to the link :

Do not store application logic in the database. There are performance limitations on running JavaScript inside MongoDB. Application code is also usually most effective when it separates version control from the application itself.

Thus, there is no equivalent for a stored procedure in mongodb.

+16
Jun 08 '17 at 10:29 on
source share



All Articles