Reputation: 184
I have a quick question that maybe someone can help me with. I am fairly new to MongoDB and I made it pretty far on my own so far.
I have created a database that contains all my employees, emails, job titles.
I uploaded these from a CSV file but the CSV file is pretty huge to edit. I was wondering if there a way I can insert a row into it so I can label them such as: Name:Email:Title
I havent been able to figure this out and any help would be great.
Upvotes: 0
Views: 124
Reputation: 442
In PHP you could do something like this :
$manager = new MongoDB\Driver\Manager("mongodb://localhost:27017");
$insRec = new MongoDB\Driver\BulkWrite;
$insRec->insert(['name' =>'Max CodeSmith', 'email'=>'[email protected]', 'title'=>'Solutions Architect']);
$writeConcern = new MongoDB\Driver\WriteConcern(MongoDB\Driver\WriteConcern::MAJORITY, 1000);
$result = $manager->executeBulkWrite('your.collection', $insRec, $writeConcern);
Upvotes: 1