MongoDB存储过程等效 [英] MongoDB Stored Procedure Equivalent

查看:114
本文介绍了MongoDB存储过程等效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含商店列表的大型CSV文件,其中一个字段是ZipCode。
我有一个名为ZipCodes的单独MongoDB数据库,它存储任何给定邮政编码的经纬度。



在SQL Server中,我将执行一个存储过程称为InsertStore,它将在ZipCodes表上查找相应的经纬度并将数据插入到Stores表中。

是否有类似于在MongoDB中为此存储过程?
基本上,对于每个插入我需要查找该商店​​的经纬度并保存。



我对这个概念不太熟悉Map / Reduce,但是这在这里有意义吗?
谢谢!

解决方案

最接近mongodb中存储过程的等价物存储为javascript。 这篇文章中有一篇关于存储javascript的很好介绍关于Mike Dirolf的博客。


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!

解决方案

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.

这篇关于MongoDB存储过程等效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆