category tree mongodb
var categories = db.getSisterDB("catalog").categories;
categories.insert([{
"name": "electronics"
, "parent": "/"
, "category": "/electronics"
}, {
"name": "embedded"
, "parent": "/electronics"
, "category": "/electronics/embedded"
}, {
"name": "cases"
, "parent": "/"
, "category": "/cases"
}, {
"name": "big"
, "parent": "/cases"
, "category": "/cases/big"
}, {
"name": "small"
, "parent": "/cases"
, "category": "/cases/small"
}]);
var products = db.getSisterDB("catalog").products;
products.insert({
"name": "Arduino"
, "cost": 125
, "currency": "USD"
, "categories": ["/electronics/embedded"]
});