Skip to content

Instantly share code, notes, and snippets.

@danared
Created October 29, 2015 20:04
Show Gist options
  • Save danared/3f20c0502ba0afa06d12 to your computer and use it in GitHub Desktop.
Save danared/3f20c0502ba0afa06d12 to your computer and use it in GitHub Desktop.
use clusterdb;
db.dropDatabase();
use clusterdb();
db.inventory.insert({ "_id" : 1, "sku" : "abc",
"description" : "product 1", "instock" : 120 });
db.inventory.insert({ "_id" : 2, "sku" : "def",
"description" : "product 2", "instock" : 80 });
db.inventory.insert({ "_id" : 3, "sku" : "ijk",
"description" : "product 3", "instock" : 60 });
db.inventory.insert({ "_id" : 4, "sku" : "jkl",
"description" : "product 4", "instock" : 70 });
db.inventory.insert({ "_id" : 5, "sku" : null,
"description" : "Incomplete" });
db.inventory.insert({ "_id" : 6 });
for (i=1000; i<2000; i++) {
db.orders.insert({
_id: i,
item: "abc",
price: i % 50,
quantity: i % 5
});
};
for (i=2000; i<3000; i++) {
db.orders.insert({
_id: i,
item: "jkl",
price: i % 30,
quantity: Math.floor(10 * Math.random()) + 1
});
};
for (i=3000; i<3200; i++) {
db.orders.insert({
_id: i,
price: i % 30,
quantity: Math.floor(10 * Math.random()) + 1
});
};
for (i=3200; i<3500; i++) {
db.orders.insert({
_id: i,
item: null,
price: i % 30,
quantity: Math.floor(10 * Math.random()) + 1
});
};
for (i=3500; i<4000; i++) {
db.orders.insert({
_id: i,
item: "abc",
price: "free",
quantity: Math.floor(10 * Math.random()) + 1
});
};
for (i=4000; i<4250; i++) {
db.orders.insert({
_id: i,
item: "abc",
price: "if you have to ask....",
quantity: Math.floor(10 * Math.random()) + 1
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment