Using Sqlbulkcopy With Mongodb
From a previous question, I'm trying to do a SqlBulkCopy from a MongoDB database, and I'm getting an error and can't find what column type I should have: The given value of type O
Solution 1:
From the Mongo spec:
ObjectId is a 12-byte BSON type, constructed using:
- a 4-byte timestamp,
- a 3-byte machine identifier,
- a 2-byte process id, and
- a 3-byte counter.
So you would need a BINARY(12) type column to map it in SQL.
Anyway, your code will run out of memory on any transfer of significance, using an intermediate DataTable in-memory copy is not the way to go. EnableStreaming and use an IDataReader to iterate over the source just-in-time.
Post a Comment for "Using Sqlbulkcopy With Mongodb"