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

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

问题描述

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

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.

在 SQL Server 中,我将执行一个名为 InsertStore 的存储过程,它会在 ZipCodes 表上进行查找以获取相应的纬度和经度并将数据插入到 Stores 表中.

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.

有没有类似于MongoDB中存储过程的概念呢?基本上,对于每个插入,我需要查找该商店​​的纬度和经度并将其保存.

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.

我对 Map/Reduce 的概念不太熟悉,但这在这里是否相关?谢谢!

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

推荐答案

最接近 mongodb 中存储过程的东西是存储 javascript.这篇文章中提供了对存储 javascript 的很好的介绍 在 Mike Dirolf 的博客上.

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天全站免登陆