Abhishek Dujari
Abhishek Dujari

Reputation: 2443

Bulk Insert (like import) bson encoded data in mongodb

I am new to mongodb and thinking of trying this out in PHP5. If someone has any info or has done this please help. Basically I have a an object (or array of arrays) in PHP that I bson_encode. I am not sure how mongo db works but it seems to support batch insert. So I was wondering how would I like [LOAD DATA...] in mongodb using the bson_encoded collection of documents. thank you

Update: ok seems like batch insert only allows array (or any insert) Maybe I misunderstood that mongodb can query in bson (including inserts). so this is what I am trying now. bson_decode and batchInsert.

Upvotes: 1

Views: 3279

Answers (1)

Gates VP
Gates VP

Reputation: 45287

Any reason you're not using the batch insert built into the PHP driver?

https://www.php.net/manual/en/mongocollection.batchinsert.php

Upvotes: 2

Related Questions