At present we got a windows service which runs a stored procedure to transfer data from one table to another. Now we need to change the stored procedure to transfer data from SQL table to Mongo collection. Could some one with Mongodb experience point me in right direction?
Asked
Active
Viewed 1,172 times
0

Solomon Rutzky
- 46,688
- 9
- 128
- 171

Dheeraj Palagiri
- 1,829
- 3
- 23
- 46
-
http://docs.mongodb.org/ ? Next question? – Neil Lunn May 21 '14 at 13:52
-
is it possible to write a stored procedure which transfers data from table to mongo collection? I been looking in http://docs.mongodb.org/manual/ could not find anything regarding this? – Dheeraj Palagiri May 21 '14 at 13:57
-
@DheerajPalagiri Are you aware that SQL stored procedures are executed by the SQL database? The SQL interpreter of your SQL database would need to have support for MongoDB to be able to do that. Why not do this in the service itself instead of the stored procedure it calls? – Philipp May 21 '14 at 13:59
-
so,what might be the best approach for me? – Dheeraj Palagiri May 21 '14 at 14:01
-
1@DheerajPalagiri Why not do this in the service itself instead of the stored procedure it calls? – Philipp May 21 '14 at 14:01
-
@Philipp thanks for the advise I will follow that. – Dheeraj Palagiri May 21 '14 at 14:21
1 Answers
1
You will probably need to get the MongoDB .NET Driver and do one of the following:
- Create a new application that connects to SQL Server, gets data from the desired table, and then connects to MongoDB to insert that data.
- Create a SQLCLR Stored Procedure that reads from the desired table and connects to MongoDB to insert the data.
Option 2 is more of a drop-in replacement as it doesn't interfere with the current structure of the Windows Service, but it might take a little bit of work to get the MongoDB .NET driver working correctly inside of SQL Server (I have not tried it so I am not sure what requirements that particular code has).

Solomon Rutzky
- 46,688
- 9
- 128
- 171