This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rem for windows | |
set mongod=start /MIN mongod | |
set mongos=start /MIN mongos | |
set name=%COMPUTERNAME% | |
mkdir a0 | |
mkdir a1 | |
mkdir a2 | |
mkdir b0 | |
mkdir b1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Setup directories | |
mkdir r1 | |
mkdir r2 | |
mkdir r3 | |
mkdir r4 | |
mkdir r5 | |
mkdir r6 | |
mkdir config | |
//create replicasets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.foo.insert( { name: "Mario", fach: ["E", "D"] } ); | |
db.foo.insert( { name: "Philipp", fach: ["PR", "D"] } ); | |
db.foo.find(); | |
db.foo.find( { name: "Mario" } ); | |
db.foo.find( { fach: { $in : [ "E", "M" ] } } ); | |
db.foo.update( { name: "Mario" }, { $push: { fach: "M" } } ); | |
db.foo.find( { name: "Mario" } ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// suggested shell cmd line to run this: | |
// | |
// mongo --shell example2.js | |
// | |
// Note: the { out : … } parameter is for mongodb 1.8+ | |
db.things.insert( { _id : 1, tags : ['dog', 'cat'] } ); | |
db.things.insert( { _id : 2, tags : ['cat'] } ); | |
db.things.insert( { _id : 3, tags : ['mouse', 'cat', 'dog'] } ); | |
db.things.insert( { _id : 4, tags : [] } ); |
NewerOlder