views:

47

answers:

1

Hello,

I have a large CSV file containing a list of stores, in which one of the field 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 do a look up on the ZipCodes table to get corresponding latitude and longitude and insert the data into the Stores table.

Is there something similar to the concept of stored procedures in MongoDB for this? Basically, for each insert I need to look up the latitude and longitude for that store and save that as well.

I am not too familiar with the concept of Map/Reduce, but would that be relevant here? Thank you!

+2  A: 

The 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.

Justin Dearing
In the current implementation of MongoDB, stored javascript is the closest thing to stored procedures, but I'm not sure I would go as far as to call it "equivalent." +1 for the helpful link though
Ari Patrick
Ari, agreed that they are not equivalent.
Justin Dearing