- Start up a mongod server
- Run the mongo shell
- Paste the content of the following JS file into the shell and press enter to execute
Check if there are 7 documents inserted by checking the result of
db.pois.count()
| var DATA = "12345678"; | |
| var c = db.getCollection("volume"); | |
| function insert(n) { | |
| var s = data(); | |
| for (i=0; i<n; i++) { | |
| if (i%200 == 0) { | |
| print(i); | |
| } | |
| var wr = c.insert({_id:i, s: s}); |
Check if there are 7 documents inserted by checking the result of
db.pois.count()
| use test | |
| db.foo.drop(); | |
| // in JSON all numbers are 32-bit floating point types (s. JSON spec) | |
| // and thus are mapped to the 64-bit floating point type in BSON | |
| db.foo.insert( {a: 1} ) |
| db.workitem.lock.drop(); | |
| db.createCollection("workitem.lock"); | |
| db.workitem.lock.ensureIndex( { ts: 1 }, { expireAfterSeconds: 30 } ); | |
| db.workitem.lock.ensureIndex( { aid: 1 }, {unique: false} ); |
${MONGO_HOME} on your disk/data/db on the same drive/partition${MONGO_HOME}/binmongod (or mongod.exe on Windows)For a more detailed explanation, see the MongoDB installation guide.