MongoDB installation is a concern in shell / shell script

I am trying to populate a collection in the MongoDB shell . As I understand it, using relaxed Write Concerncan speed up the process. I am talking about documentation about how it Write Concernsworks, but all he talks about is how they work, not how to install them (this says that it is installed in the driver). And I saw documents for different drivers and how they are installed in them, but I can’t find how they Write Concernsare installed in the MongoDB shell ! Does anyone know how to install them from the shell?

[UPDATE]

To populate my database, I used the file .jsand passed it to the command mongoas follows:

mongo ./test.js

And here is the contents of the file test.js:

for (var i=0; i<1000000; i++) {
    db.kingdom.insert([
        { "counter" : 0, "last_update" : new Date() }
        , { "counter" : 0, "last_update" : new Date() }
        ...
        , { "counter" : 0, "last_update" : new Date() }
    ]);
}

An array of data for 100 objects of the same structure.

+4
source share
1 answer

You can specify a write problem for each insert / update operation :

db.blogs.insert ({title: 'new blog post'}, {writeConcern: {j: true}})

0
source

All Articles