Primer Opcion Examen NOSQL

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 51

use ProyectoABC

switched to db ProyectoABC
db.Ventas.find()
{

_id: ObjectId("64c1e7496e0e0aad56ad1dbc"),

The_Year: 2004,

The_Month: 200402,

The_Date: '2004-02-15T00:00:00',

Time_ID: 20040215,

product_id: 873,

customer_id: 6370,
promotion_id: 0,

'SalesFact.store_id': 1,

store_sales: 7.05,

store_cost: 2.115,

unit_sales: 3,

product_name: 'Nationeel Dried Apricots',

IdBrand: 95,

Brand: 'Nationeel',

Subcategory_id: 109,

product_subcategory: 'Dried Fruit',

DepartmentId: 21,

Department: 'Snack Foods',

Family: 'Food',

FamiltyId: 2,

Category: 'Snack Foods',

IDCategory: 44,

promotion_name: 'No Promotion',

promotion_district_id: 0,

promotion_district_name: 'no district',

media_type: 'No Media',

cost: 0,

'Stores.store_id': 1,

store_name: 'Store 1',

region_id: 5,

sales_region: 'Mexico West',


Country: 'Mexico',

Country_Id: 1

_id: ObjectId("64c1e7496e0e0aad56ad1dbd"),

The_Year: 2004,

The_Month: 200402,

The_Date: '2004-02-15T00:00:00',

Time_ID: 20040215,

product_id: 949,

customer_id: 2974,

promotion_id: 0,

'SalesFact.store_id': 1,

store_sales: 10.04,

store_cost: 4.3172,

unit_sales: 4,

product_name: 'Fabulous Apple Drink',

IdBrand: 89,

Brand: 'Fabulous',

Subcategory_id: 52,

product_subcategory: 'Flavored Drinks',

DepartmentId: 4,

Department: 'Beverages',

Family: 'Drink',

FamiltyId: 1,

Category: 'Drinks',

IDCategory: 20,

promotion_name: 'No Promotion',

promotion_district_id: 0,

promotion_district_name: 'no district',

media_type: 'No Media',

cost: 0,

'Stores.store_id': 1,

store_name: 'Store 1',

region_id: 5,

sales_region: 'Mexico West',


Country: 'Mexico',

Country_Id: 1

_id: ObjectId("64c1e7496e0e0aad56ad1dbe"),

The_Year: 2004,

The_Month: 200402,

The_Date: '2004-02-15T00:00:00',

Time_ID: 20040215,

product_id: 333,

customer_id: 2974,

promotion_id: 0,

'SalesFact.store_id': 1,

store_sales: 2.64,

store_cost: 0.8976,

unit_sales: 2,

product_name: 'Better Canned Tomatos',

IdBrand: 53,

Brand: 'Better',

Subcategory_id: 62,

product_subcategory: 'Canned Vegetables',

DepartmentId: 6,

Department: 'Canned Foods',

Family: 'Food',

FamiltyId: 2,

Category: 'Vegetables',

IDCategory: 47,

promotion_name: 'No Promotion',

promotion_district_id: 0,

promotion_district_name: 'no district',

media_type: 'No Media',

cost: 0,

'Stores.store_id': 1,

store_name: 'Store 1',

region_id: 5,

sales_region: 'Mexico West',


Country: 'Mexico',

Country_Id: 1

_id: ObjectId("64c1e7496e0e0aad56ad1dbf"),

The_Year: 2004,

The_Month: 200402,

The_Date: '2004-02-15T00:00:00',

Time_ID: 20040215,

product_id: 677,

customer_id: 2974,

promotion_id: 0,

'SalesFact.store_id': 1,

store_sales: 8.88,

store_cost: 3.3744,

unit_sales: 3,

product_name: 'Gorilla Large Curd Cottage Cheese',

IdBrand: 68,

Brand: 'Gorilla',

Subcategory_id: 15,

product_subcategory: 'Cottage Cheese',

DepartmentId: 10,

Department: 'Dairy',

Family: 'Food',

FamiltyId: 2,

Category: 'Dairy',

IDCategory: 18,

promotion_name: 'No Promotion',

promotion_district_id: 0,

promotion_district_name: 'no district',

media_type: 'No Media',

cost: 0,

'Stores.store_id': 1,

store_name: 'Store 1',

region_id: 5,

sales_region: 'Mexico West',


Country: 'Mexico',

Country_Id: 1

_id: ObjectId("64c1e7496e0e0aad56ad1dc0"),

The_Year: 2004,

The_Month: 200402,

The_Date: '2004-02-15T00:00:00',

Time_ID: 20040215,

product_id: 1219,

customer_id: 2974,

promotion_id: 0,

'SalesFact.store_id': 1,

store_sales: 7.08,

store_cost: 2.9736,

unit_sales: 3,

product_name: 'Sphinx Blueberry Muffins',

IdBrand: 45,

Brand: 'Sphinx',

Subcategory_id: 26,

product_subcategory: 'Muffins',

DepartmentId: 2,

Department: 'Baked Goods',

Family: 'Food',

FamiltyId: 2,

Category: 'Bread',

IDCategory: 4,

promotion_name: 'No Promotion',

promotion_district_id: 0,

promotion_district_name: 'no district',

media_type: 'No Media',

cost: 0,

'Stores.store_id': 1,

store_name: 'Store 1',

region_id: 5,

sales_region: 'Mexico West',


Country: 'Mexico',

Country_Id: 1

_id: ObjectId("64c1e7496e0e0aad56ad1dc1"),

The_Year: 2004,

The_Month: 200402,

The_Date: '2004-02-15T00:00:00',

Time_ID: 20040215,

product_id: 1282,

customer_id: 2974,

promotion_id: 0,

'SalesFact.store_id': 1,

store_sales: 6.88,

store_cost: 2.2704,

unit_sales: 2,

product_name: 'Pleasant Fancy Canned Anchovies',

IdBrand: 22,

Brand: 'Pleasant',

Subcategory_id: 95,

product_subcategory: 'Anchovies',

DepartmentId: 6,

Department: 'Canned Foods',

Family: 'Food',

FamiltyId: 2,

Category: 'Canned Anchovies',

IDCategory: 8,

promotion_name: 'No Promotion',

promotion_district_id: 0,

promotion_district_name: 'no district',

media_type: 'No Media',

cost: 0,

'Stores.store_id': 1,

store_name: 'Store 1',

region_id: 5,

sales_region: 'Mexico West',


Country: 'Mexico',

Country_Id: 1

_id: ObjectId("64c1e7496e0e0aad56ad1dc2"),

The_Year: 2004,

The_Month: 200402,

The_Date: '2004-02-15T00:00:00',

Time_ID: 20040215,

product_id: 360,

customer_id: 2974,

promotion_id: 0,

'SalesFact.store_id': 1,

store_sales: 3.93,

store_cost: 1.7292,

unit_sales: 3,

product_name: 'Carlson Low Fat String Cheese',

IdBrand: 26,

Brand: 'Carlson',

Subcategory_id: 11,

product_subcategory: 'Cheese',

DepartmentId: 10,

Department: 'Dairy',

Family: 'Food',

FamiltyId: 2,

Category: 'Dairy',

IDCategory: 18,

promotion_name: 'No Promotion',

promotion_district_id: 0,

promotion_district_name: 'no district',

media_type: 'No Media',

cost: 0,

'Stores.store_id': 1,

store_name: 'Store 1',

region_id: 5,

sales_region: 'Mexico West',


Country: 'Mexico',

Country_Id: 1

_id: ObjectId("64c1e7496e0e0aad56ad1dc3"),

The_Year: 2004,

The_Month: 200402,

The_Date: '2004-02-15T00:00:00',

Time_ID: 20040215,

product_id: 910,

customer_id: 9562,

promotion_id: 0,

'SalesFact.store_id': 1,

store_sales: 3.68,

store_cost: 1.3616,

unit_sales: 2,

product_name: 'BBB Best Sesame Oil',

IdBrand: 55,

Brand: 'BBB Best',

Subcategory_id: 49,

product_subcategory: 'Cooking Oil',

DepartmentId: 3,

Department: 'Baking Goods',

Family: 'Food',

FamiltyId: 2,

Category: 'Baking Goods',

IDCategory: 1,

promotion_name: 'No Promotion',

promotion_district_id: 0,

promotion_district_name: 'no district',

media_type: 'No Media',

cost: 0,

'Stores.store_id': 1,

store_name: 'Store 1',

region_id: 5,

sales_region: 'Mexico West',


Country: 'Mexico',

Country_Id: 1

_id: ObjectId("64c1e7496e0e0aad56ad1dc4"),

The_Year: 2004,

The_Month: 200402,

The_Date: '2004-02-15T00:00:00',

Time_ID: 20040215,

product_id: 866,

customer_id: 9562,

promotion_id: 0,

'SalesFact.store_id': 1,

store_sales: 10.38,

store_cost: 3.5292,

unit_sales: 3,

product_name: 'Nationeel Apple Fruit Roll',

IdBrand: 95,

Brand: 'Nationeel',

Subcategory_id: 109,

product_subcategory: 'Dried Fruit',

DepartmentId: 21,

Department: 'Snack Foods',

Family: 'Food',

FamiltyId: 2,

Category: 'Snack Foods',

IDCategory: 44,

promotion_name: 'No Promotion',

promotion_district_id: 0,

promotion_district_name: 'no district',

media_type: 'No Media',

cost: 0,

'Stores.store_id': 1,

store_name: 'Store 1',

region_id: 5,

sales_region: 'Mexico West',


Country: 'Mexico',

Country_Id: 1

_id: ObjectId("64c1e7496e0e0aad56ad1dc5"),

The_Year: 2004,

The_Month: 200402,

The_Date: '2004-02-15T00:00:00',

Time_ID: 20040215,

product_id: 637,

customer_id: 9562,

promotion_id: 0,

'SalesFact.store_id': 1,

store_sales: 1.72,

store_cost: 0.5504,

unit_sales: 2,

product_name: 'Radius Grits',

IdBrand: 82,

Brand: 'Radius',

Subcategory_id: 35,

product_subcategory: 'Cereal',

DepartmentId: 5,

Department: 'Breakfast Foods',

Family: 'Food',

FamiltyId: 2,

Category: 'Breakfast Foods',

IDCategory: 5,

promotion_name: 'No Promotion',

promotion_district_id: 0,

promotion_district_name: 'no district',

media_type: 'No Media',

cost: 0,

'Stores.store_id': 1,

store_name: 'Store 1',

region_id: 5,

sales_region: 'Mexico West',


Country: 'Mexico',

Country_Id: 1

_id: ObjectId("64c1e7496e0e0aad56ad1dc6"),

The_Year: 2004,

The_Month: 200402,

The_Date: '2004-02-15T00:00:00',

Time_ID: 20040215,

product_id: 194,

customer_id: 9562,

promotion_id: 0,

'SalesFact.store_id': 1,

store_sales: 10.08,

store_cost: 3.6288,

unit_sales: 3,

product_name: 'High Top Firm Tofu',

IdBrand: 48,

Brand: 'High Top',

Subcategory_id: 67,

product_subcategory: 'Tofu',

DepartmentId: 19,

Department: 'Produce',

Family: 'Food',

FamiltyId: 2,

Category: 'Packaged Vegetables',

IDCategory: 36,

promotion_name: 'No Promotion',

promotion_district_id: 0,

promotion_district_name: 'no district',

media_type: 'No Media',

cost: 0,

'Stores.store_id': 1,

store_name: 'Store 1',

region_id: 5,

sales_region: 'Mexico West',


Country: 'Mexico',

Country_Id: 1

_id: ObjectId("64c1e7496e0e0aad56ad1dc7"),

The_Year: 2004,

The_Month: 200402,

The_Date: '2004-02-15T00:00:00',

Time_ID: 20040215,

product_id: 1242,

customer_id: 9562,

promotion_id: 0,

'SalesFact.store_id': 1,

store_sales: 3.96,

store_cost: 1.8612,

unit_sales: 2,

product_name: 'Plato Grape Jam',

IdBrand: 71,

Brand: 'Plato',

Subcategory_id: 32,

product_subcategory: 'Jam',

DepartmentId: 3,

Department: 'Baking Goods',

Family: 'Food',

FamiltyId: 2,

Category: 'Jams and Jellies',

IDCategory: 30,

promotion_name: 'No Promotion',

promotion_district_id: 0,

promotion_district_name: 'no district',

media_type: 'No Media',

cost: 0,

'Stores.store_id': 1,

store_name: 'Store 1',

region_id: 5,

sales_region: 'Mexico West',


Country: 'Mexico',

Country_Id: 1

_id: ObjectId("64c1e7496e0e0aad56ad1dc8"),

The_Year: 2004,

The_Month: 200402,

The_Date: '2004-02-15T00:00:00',

Time_ID: 20040215,

product_id: 893,

customer_id: 9562,

promotion_id: 0,

'SalesFact.store_id': 1,

store_sales: 1.82,

store_cost: 0.8008,

unit_sales: 2,

product_name: 'Pearl Imported Beer',

IdBrand: 88,

Brand: 'Pearl',

Subcategory_id: 43,

product_subcategory: 'Beer',

DepartmentId: 1,

Department: 'Alcoholic Beverages',

Family: 'Drink',

FamiltyId: 1,

Category: 'Beer and Wine',

IDCategory: 3,

promotion_name: 'No Promotion',

promotion_district_id: 0,

promotion_district_name: 'no district',

media_type: 'No Media',

cost: 0,

'Stores.store_id': 1,

store_name: 'Store 1',

region_id: 5,

sales_region: 'Mexico West',


Country: 'Mexico',

Country_Id: 1

_id: ObjectId("64c1e7496e0e0aad56ad1dc9"),

The_Year: 2004,

The_Month: 200402,

The_Date: '2004-02-17T00:00:00',

Time_ID: 20040217,

product_id: 500,

customer_id: 8315,

promotion_id: 0,

'SalesFact.store_id': 1,

store_sales: 5.32,

store_cost: 2.5004,

unit_sales: 2,

product_name: 'Tell Tale Baby Onion',

IdBrand: 21,

Brand: 'Tell Tale',

Subcategory_id: 61,

product_subcategory: 'Fresh Vegetables',

DepartmentId: 19,

Department: 'Produce',

Family: 'Food',

FamiltyId: 2,

Category: 'Vegetables',

IDCategory: 47,

promotion_name: 'No Promotion',

promotion_district_id: 0,

promotion_district_name: 'no district',

media_type: 'No Media',

cost: 0,

'Stores.store_id': 1,

store_name: 'Store 1',

region_id: 5,

sales_region: 'Mexico West',


Country: 'Mexico',

Country_Id: 1

_id: ObjectId("64c1e7496e0e0aad56ad1dca"),

The_Year: 2004,

The_Month: 200402,

The_Date: '2004-02-15T00:00:00',

Time_ID: 20040215,

product_id: 1328,

customer_id: 6370,

promotion_id: 0,

'SalesFact.store_id': 1,

store_sales: 4.52,

store_cost: 1.4916,

unit_sales: 2,

product_name: 'Giant Small Eggs',

IdBrand: 16,

Brand: 'Giant',

Subcategory_id: 66,

product_subcategory: 'Eggs',

DepartmentId: 12,

Department: 'Eggs',

Family: 'Food',

FamiltyId: 2,

Category: 'Eggs',

IDCategory: 22,

promotion_name: 'No Promotion',

promotion_district_id: 0,

promotion_district_name: 'no district',

media_type: 'No Media',

cost: 0,

'Stores.store_id': 1,

store_name: 'Store 1',

region_id: 5,

sales_region: 'Mexico West',


Country: 'Mexico',

Country_Id: 1

_id: ObjectId("64c1e7496e0e0aad56ad1dcb"),

The_Year: 2004,

The_Month: 200402,

The_Date: '2004-02-15T00:00:00',

Time_ID: 20040215,

product_id: 784,

customer_id: 7304,

promotion_id: 0,

'SalesFact.store_id': 1,

store_sales: 2.08,

store_cost: 0.8944,

unit_sales: 4,

product_name: 'Cormorant Large Sponge',

IdBrand: 7,

Brand: 'Cormorant',

Subcategory_id: 42,

product_subcategory: 'Sponges',

DepartmentId: 15,

Department: 'Household',

Family: 'Non-Consumable',

FamiltyId: 3,

Category: 'Kitchen Products',

IDCategory: 31,

promotion_name: 'No Promotion',

promotion_district_id: 0,

promotion_district_name: 'no district',

media_type: 'No Media',

cost: 0,

'Stores.store_id': 1,

store_name: 'Store 1',

region_id: 5,

sales_region: 'Mexico West',


Country: 'Mexico',

Country_Id: 1

_id: ObjectId("64c1e7496e0e0aad56ad1dcc"),

The_Year: 2004,

The_Month: 200402,

The_Date: '2004-02-15T00:00:00',

Time_ID: 20040215,

product_id: 124,

customer_id: 6370,

promotion_id: 0,

'SalesFact.store_id': 1,

store_sales: 3.63,

store_cost: 1.2342,

unit_sales: 3,

product_name: 'Faux Products 200 MG Ibuprofen',

IdBrand: 108,

Brand: 'Faux Products',

Subcategory_id: 71,

product_subcategory: 'Ibuprofen',

DepartmentId: 14,

Department: 'Health and Hygiene',

Family: 'Non-Consumable',

FamiltyId: 3,

Category: 'Pain Relievers',

IDCategory: 37,

promotion_name: 'No Promotion',

promotion_district_id: 0,

promotion_district_name: 'no district',

media_type: 'No Media',

cost: 0,

'Stores.store_id': 1,

store_name: 'Store 1',

region_id: 5,

sales_region: 'Mexico West',


Country: 'Mexico',

Country_Id: 1

_id: ObjectId("64c1e7496e0e0aad56ad1dcd"),

The_Year: 2004,

The_Month: 200402,

The_Date: '2004-02-15T00:00:00',

Time_ID: 20040215,

product_id: 373,

customer_id: 6370,

promotion_id: 0,

'SalesFact.store_id': 1,

store_sales: 8.28,

store_cost: 3.726,

unit_sales: 3,

product_name: 'Carlson Blueberry Yogurt',

IdBrand: 26,

Brand: 'Carlson',

Subcategory_id: 6,

product_subcategory: 'Yogurt',

DepartmentId: 10,

Department: 'Dairy',

Family: 'Food',

FamiltyId: 2,

Category: 'Dairy',

IDCategory: 18,

promotion_name: 'No Promotion',

promotion_district_id: 0,

promotion_district_name: 'no district',

media_type: 'No Media',

cost: 0,

'Stores.store_id': 1,

store_name: 'Store 1',

region_id: 5,

sales_region: 'Mexico West',


Country: 'Mexico',

Country_Id: 1

_id: ObjectId("64c1e7496e0e0aad56ad1dce"),

The_Year: 2004,

The_Month: 200402,

The_Date: '2004-02-15T00:00:00',

Time_ID: 20040215,

product_id: 290,

customer_id: 6370,

promotion_id: 0,

'SalesFact.store_id': 1,

store_sales: 3.4,

store_cost: 1.258,

unit_sales: 2,

product_name: 'Super Regular Coffee',

IdBrand: 58,

Brand: 'Super',

Subcategory_id: 90,

product_subcategory: 'Coffee',

DepartmentId: 4,

Department: 'Beverages',

Family: 'Drink',

FamiltyId: 1,

Category: 'Hot Beverages',

IDCategory: 28,

promotion_name: 'No Promotion',

promotion_district_id: 0,

promotion_district_name: 'no district',

media_type: 'No Media',

cost: 0,

'Stores.store_id': 1,

store_name: 'Store 1',

region_id: 5,

sales_region: 'Mexico West',


Country: 'Mexico',

Country_Id: 1

_id: ObjectId("64c1e7496e0e0aad56ad1dcf"),

The_Year: 2004,

The_Month: 200402,

The_Date: '2004-02-15T00:00:00',

Time_ID: 20040215,

product_id: 180,

customer_id: 6370,

promotion_id: 0,

'SalesFact.store_id': 1,

store_sales: 1.38,

store_cost: 0.552,

unit_sales: 2,

product_name: 'High Top Shitake Mushrooms',

IdBrand: 48,

Brand: 'High Top',

Subcategory_id: 61,

product_subcategory: 'Fresh Vegetables',

DepartmentId: 19,

Department: 'Produce',

Family: 'Food',

FamiltyId: 2,

Category: 'Vegetables',

IDCategory: 47,

promotion_name: 'No Promotion',

promotion_district_id: 0,

promotion_district_name: 'no district',

media_type: 'No Media',

cost: 0,

'Stores.store_id': 1,

store_name: 'Store 1',

region_id: 5,

sales_region: 'Mexico West',


Country: 'Mexico',

Country_Id: 1

}
Type "it" for more

1. Listado de Productos:

db.Ventas.find({},{"product_name":1})
{
_id: ObjectId("64c1e7496e0e0aad56ad1dbc"),
product_name: 'Nationeel Dried Apricots'
}
{
_id: ObjectId("64c1e7496e0e0aad56ad1dbd"),
product_name: 'Fabulous Apple Drink'
}
{
_id: ObjectId("64c1e7496e0e0aad56ad1dbe"),
product_name: 'Better Canned Tomatos'
}
{
_id: ObjectId("64c1e7496e0e0aad56ad1dbf"),
product_name: 'Gorilla Large Curd Cottage Cheese'
}
{
_id: ObjectId("64c1e7496e0e0aad56ad1dc0"),
product_name: 'Sphinx Blueberry Muffins'
}
{
_id: ObjectId("64c1e7496e0e0aad56ad1dc1"),
product_name: 'Pleasant Fancy Canned Anchovies'
}
{
_id: ObjectId("64c1e7496e0e0aad56ad1dc2"),
product_name: 'Carlson Low Fat String Cheese'
}
{
_id: ObjectId("64c1e7496e0e0aad56ad1dc3"),
product_name: 'BBB Best Sesame Oil'
}
{
_id: ObjectId("64c1e7496e0e0aad56ad1dc4"),
product_name: 'Nationeel Apple Fruit Roll'
}
{
_id: ObjectId("64c1e7496e0e0aad56ad1dc5"),
product_name: 'Radius Grits'
}
{
_id: ObjectId("64c1e7496e0e0aad56ad1dc6"),
product_name: 'High Top Firm Tofu'
}
{
_id: ObjectId("64c1e7496e0e0aad56ad1dc7"),
product_name: 'Plato Grape Jam'
}
{
_id: ObjectId("64c1e7496e0e0aad56ad1dc8"),
product_name: 'Pearl Imported Beer'
}
{
_id: ObjectId("64c1e7496e0e0aad56ad1dc9"),
product_name: 'Tell Tale Baby Onion'
}
{
_id: ObjectId("64c1e7496e0e0aad56ad1dca"),
product_name: 'Giant Small Eggs'
}
{
_id: ObjectId("64c1e7496e0e0aad56ad1dcb"),
product_name: 'Cormorant Large Sponge'
}
{
_id: ObjectId("64c1e7496e0e0aad56ad1dcc"),
product_name: 'Faux Products 200 MG Ibuprofen'
}
{
_id: ObjectId("64c1e7496e0e0aad56ad1dcd"),
product_name: 'Carlson Blueberry Yogurt'
}
{
_id: ObjectId("64c1e7496e0e0aad56ad1dce"),
product_name: 'Super Regular Coffee'
}
{
_id: ObjectId("64c1e7496e0e0aad56ad1dcf"),
product_name: 'High Top Shitake Mushrooms'
}
Type "it" for more

Consulta sin ID

db.Ventas.find({},{_id:0,"product_name":1})
{
product_name: 'Nationeel Dried Apricots'
}
{
product_name: 'Fabulous Apple Drink'
}
{
product_name: 'Better Canned Tomatos'
}
{
product_name: 'Gorilla Large Curd Cottage Cheese'
}
{
product_name: 'Sphinx Blueberry Muffins'
}
{
product_name: 'Pleasant Fancy Canned Anchovies'
}
{
product_name: 'Carlson Low Fat String Cheese'
}
{
product_name: 'BBB Best Sesame Oil'
}
{
product_name: 'Nationeel Apple Fruit Roll'
}
{
product_name: 'Radius Grits'
}
{
product_name: 'High Top Firm Tofu'
}
{
product_name: 'Plato Grape Jam'
}
{
product_name: 'Pearl Imported Beer'
}
{
product_name: 'Tell Tale Baby Onion'
}
{
product_name: 'Giant Small Eggs'
}
{
product_name: 'Cormorant Large Sponge'
}
{
product_name: 'Faux Products 200 MG Ibuprofen'
}
{
product_name: 'Carlson Blueberry Yogurt'
}
{
product_name: 'Super Regular Coffee'
}
{
product_name: 'High Top Shitake Mushrooms'
}
Type "it" for more

Con Dsitinct

db.Ventas.distinct("product_name")
'BBB Best Strawberry Jam',
'BBB Best Strawberry Jelly',
'BBB Best Strawberry Preserves',
'BBB Best Tomato Sauce',
'BBB Best Vegetable Oil',
'BBB Best White Sugar',
'Best Choice Apple Fruit Roll',
'Best Choice Avocado Dip',
'Best Choice BBQ Potato Chips',
'Best Choice Beef Jerky',
'Best Choice Buttered Popcorn',
'Best Choice Cheese Crackers',
'Best Choice Cheese Dip',
'Best Choice Chocolate Chip Cookies',
'Best Choice Chocolate Donuts',
'Best Choice Corn Chips',
'Best Choice Dried Apples',
'Best Choice Dried Apricots',
'Best Choice Dried Dates',
'Best Choice Fondue Mix',
'Best Choice Frosted Cookies',
'Best Choice Frosted Donuts',
'Best Choice Fudge Brownies',
'Best Choice Fudge Cookies',
'Best Choice Golden Raisins',
'Best Choice Graham Crackers',
'Best Choice Grape Fruit Roll',
'Best Choice Lemon Cookies',
'Best Choice Low Fat BBQ Chips',
'Best Choice Low Fat Chips',
'Best Choice Low Fat Cookies',
'Best Choice Low Fat Popcorn',
'Best Choice Mini Donuts',
'Best Choice No Salt Popcorn',
'Best Choice Potato Chips',
'Best Choice Raisins',
'Best Choice Raspberry Fruit Roll',
'Best Choice Salsa Dip',
'Best Choice Salted Pretzels',
'Best Choice Sesame Crackers',
'Best Choice Strawberry Fruit Roll',
'Best Choice Sugar Cookies',
'Best Corn Puffs',
'Best Grits',
'Best Oatmeal',
'Best Wheat Puffs',
'Better Beef Soup',
'Better Canned Beets',
... 1459 more items
]

2. Listado de Categorías y Subcategorías de productos


db.Ventas.aggregate([
{
"$group": {
"_id": {
"Category": "$Category",
"product_subcategory": "$product_subcategory"
}
}
},
{
"$project": {
"_id": 0,
"Category": "$_id.Category",
"product_subcategory": "$_id.product_subcategory"
}
}
])
{
Category: 'Magazines',
product_subcategory: 'Computer Magazines'
}
{
Category: 'Snack Foods',
product_subcategory: 'Dried Fruit'
}
{
Category: 'Snack Foods',
product_subcategory: 'Cookies'
}
{
Category: 'Drinks',
product_subcategory: 'Flavored Drinks'
}
{
Category: 'Fruit',
product_subcategory: 'Canned Fruit'
}
{
Category: 'Seafood',
product_subcategory: 'Shellfish'
}
{
Category: 'Bathroom Products',
product_subcategory: 'Mouthwash'
}
{
Category: 'Canned Oysters',
product_subcategory: 'Oysters'
}
{
Category: 'Meat',
product_subcategory: 'Fresh Chicken'
}
{
Category: 'Pain Relievers',
product_subcategory: 'Ibuprofen'
}
{
Category: 'Snack Foods',
product_subcategory: 'Chips'
}
{
Category: 'Jams and Jellies',
product_subcategory: 'Preserves'
}
{
Category: 'Specialty',
product_subcategory: 'Nuts'
}
{
Category: 'Frozen Entrees',
product_subcategory: 'TV Dinner'
}
{
Category: 'Hot Beverages',
product_subcategory: 'Chocolate'
}
{
Category: 'Magazines',
product_subcategory: 'Auto Magazines'
}
{
Category: 'Baking Goods',
product_subcategory: 'Cooking Oil'
}
{
Category: 'Cleaning Supplies',
product_subcategory: 'Cleaners'
}
{
Category: 'Vegetables',
product_subcategory: 'French Fries'
}
{
Category: 'Kitchen Products',
product_subcategory: 'Sponges'
}
Type "it" for more

3. Listado de Familias de Productos

db.Ventas.find({},{_id:0,"Family":1})
{
Family: 'Food'
}
{
Family: 'Drink'
}
{
Family: 'Food'
}
{
Family: 'Food'
}
{
Family: 'Food'
}
{
Family: 'Food'
}
{
Family: 'Food'
}
{
Family: 'Food'
}
{
Family: 'Food'
}
{
Family: 'Food'
}
{
Family: 'Food'
}
{
Family: 'Food'
}
{
Family: 'Drink'
}
{
Family: 'Food'
}
{
Family: 'Food'
}
{
Family: 'Non-Consumable'
}
{
Family: 'Non-Consumable'
}
{
Family: 'Food'
}
{
Family: 'Drink'
}
{
Family: 'Food'
}
Type "it" for more

4. Listado de Departamentos

db.Ventas.find({},{_id:0,"Department":1})
{
Department: 'Snack Foods'
}
{
Department: 'Beverages'
}
{
Department: 'Canned Foods'
}
{
Department: 'Dairy'
}
{
Department: 'Baked Goods'
}
{
Department: 'Canned Foods'
}
{
Department: 'Dairy'
}
{
Department: 'Baking Goods'
}
{
Department: 'Snack Foods'
}
{
Department: 'Breakfast Foods'
}
{
Department: 'Produce'
}
{
Department: 'Baking Goods'
}
{
Department: 'Alcoholic Beverages'
}
{
Department: 'Produce'
}
{
Department: 'Eggs'
}
{
Department: 'Household'
}
{
Department: 'Health and Hygiene'
}
{
Department: 'Dairy'
}
{
Department: 'Beverages'
}
{
Department: 'Produce'
}
Type "it" for more

5. Listado de Paises

db.Ventas.find({},{_id:0,"Country":1})
{
Country: 'Mexico'
}
{
Country: 'Mexico'
}
{
Country: 'Mexico'
}
{
Country: 'Mexico'
}
{
Country: 'Mexico'
}
{
Country: 'Mexico'
}
{
Country: 'Mexico'
}
{
Country: 'Mexico'
}
{
Country: 'Mexico'
}
{
Country: 'Mexico'
}
{
Country: 'Mexico'
}
{
Country: 'Mexico'
}
{
Country: 'Mexico'
}
{
Country: 'Mexico'
}
{
Country: 'Mexico'
}
{
Country: 'Mexico'
}
{
Country: 'Mexico'
}
{
Country: 'Mexico'
}
{
Country: 'Mexico'
}
{
Country: 'Mexico'
}
Type "it" for more

6. Listado de Regiones

db.Ventas.find({},{_id:0,"sales_region":1})
{
sales_region: 'Mexico West'
}
{
sales_region: 'Mexico West'
}
{
sales_region: 'Mexico West'
}
{
sales_region: 'Mexico West'
}
{
sales_region: 'Mexico West'
}
{
sales_region: 'Mexico West'
}
{
sales_region: 'Mexico West'
}
{
sales_region: 'Mexico West'
}
{
sales_region: 'Mexico West'
}
{
sales_region: 'Mexico West'
}
{
sales_region: 'Mexico West'
}
{
sales_region: 'Mexico West'
}
{
sales_region: 'Mexico West'
}
{
sales_region: 'Mexico West'
}
{
sales_region: 'Mexico West'
}
{
sales_region: 'Mexico West'
}
{
sales_region: 'Mexico West'
}
{
sales_region: 'Mexico West'
}
{
sales_region: 'Mexico West'
}
{
sales_region: 'Mexico West'
}
Type "it" for more

7. Listado de Nombres de Tiendas

db.Ventas.find({},{_id:0,"store_name":1})
{
store_name: 'Store 1'
}
{
store_name: 'Store 1'
}
{
store_name: 'Store 1'
}
{
store_name: 'Store 1'
}
{
store_name: 'Store 1'
}
{
store_name: 'Store 1'
}
{
store_name: 'Store 1'
}
{
store_name: 'Store 1'
}
{
store_name: 'Store 1'
}
{
store_name: 'Store 1'
}
{
store_name: 'Store 1'
}
{
store_name: 'Store 1'
}
{
store_name: 'Store 1'
}
{
store_name: 'Store 1'
}
{
store_name: 'Store 1'
}
{
store_name: 'Store 1'
}
{
store_name: 'Store 1'
}
{
store_name: 'Store 1'
}
{
store_name: 'Store 1'
}
{
store_name: 'Store 1'
}
Type "it" for more

1. Monto de Venta por Tienda

db.Ventas.aggregate([
{
$group:{
_id:"$store_name",
MontoVenta: {$sum: "$store_sales"}
}
},
{
$sort: {MontoVenta: -1}
}
])

{
_id: 'Store 13',
MontoVenta: 162183.52
}
{
_id: 'Store 17',
MontoVenta: 150063.09
}
{
_id: 'Store 15',
MontoVenta: 109223.53
}
{
_id: 'Store 11',
MontoVenta: 108692.05
}
{
_id: 'Store 24',
MontoVenta: 106051.54
}
{
_id: 'Store 7',
MontoVenta: 105364.43
}
{
_id: 'Store 16',
MontoVenta: 104619.4
}
{
_id: 'Store 3',
MontoVenta: 104031.49
}
{
_id: 'Store 6',
MontoVenta: 93594.16
}
{
_id: 'Store 8',
MontoVenta: 79063.13
}
{
_id: 'Store 12',
MontoVenta: 79045.67
}
{
_id: 'Store 19',
MontoVenta: 77931.17
}
{
_id: 'Store 21',
MontoVenta: 72383.61
}
{
_id: 'Store 10',
MontoVenta: 52142.07
}
{
_id: 'Store 4',
MontoVenta: 50047.51
}
{
_id: 'Store 1',
MontoVenta: 49090.03
}
{
_id: 'Store 23',
MontoVenta: 45094.18
}
{
_id: 'Store 9',
MontoVenta: 23142.79
}
{
_id: 'Store 18',
MontoVenta: 21049.91
}
{
_id: 'Store 20',
MontoVenta: 20114.29
}
Type "it" for more

2. Monto de Venta por Categoría de Producto

db.Ventas.aggregate([
{
$group:{
_id:"$Category",
MontoVenta: {$sum: "$store_sales"}
}
},
{
$sort: {MontoVenta: -1}
}
])
{
_id: 'Vegetables',
MontoVenta: 206070.44
}
{
_id: 'Snack Foods',
MontoVenta: 197840.85
}
{
_id: 'Dairy',
MontoVenta: 108634.29
}
{
_id: 'Meat',
MontoVenta: 88882.42
}
{
_id: 'Fruit',
MontoVenta: 84031.36
}
{
_id: 'Jams and Jellies',
MontoVenta: 67426.72
}
{
_id: 'Bread',
MontoVenta: 48416.97
}
{
_id: 'Electrical',
MontoVenta: 47631.87
}
{
_id: 'Baking Goods',
MontoVenta: 46210.06
}
{
_id: 'Breakfast Foods',
MontoVenta: 46114.46
}
{
_id: 'Canned Soup',
MontoVenta: 45512.57
}
{
_id: 'Paper Products',
MontoVenta: 44303.75
}
{
_id: 'Candy',
MontoVenta: 42340.18
}
{
_id: 'Beer and Wine',
MontoVenta: 41137.07
}
{
_id: 'Bathroom Products',
MontoVenta: 38898.25
}
{
_id: 'Frozen Desserts',
MontoVenta: 37177
}
{
_id: 'Starchy Foods',
MontoVenta: 33891.81
}
{
_id: 'Specialty',
MontoVenta: 30895.15
}
{
_id: 'Kitchen Products',
MontoVenta: 27878.74
}
{
_id: 'Hot Beverages',
MontoVenta: 26227.46
}
Type "it" for more

3. Monto de Venta por Familia de Producto

db.Ventas.aggregate([
{
$group:{
_id:"$product_name",
MontoVenta: {$sum: "$store_sales"}
}
},
{
$sort: {MontoVenta: -1}
}
])
{
_id: 'Hermanos Green Pepper',
MontoVenta: 2370.04
}
{
_id: 'Even Better Large Curd Cottage Cheese',
MontoVenta: 2263.35
}
{
_id: 'Hilltop Mint Mouthwash',
MontoVenta: 2251.64
}
{
_id: 'Carlson Head Cheese',
MontoVenta: 2250.9900000000002
}
{
_id: 'Great Pumpernickel Bread',
MontoVenta: 2244
}
{
_id: 'Fort West BBQ Potato Chips',
MontoVenta: 2203.84
}
{
_id: 'Fabulous Strawberry Drink',
MontoVenta: 2192.25
}
{
_id: 'Hermanos Lemons',
MontoVenta: 2182.76
}
{
_id: 'Moms Foot-Long Hot Dogs',
MontoVenta: 2167.55
}
{
_id: 'Tell Tale Cantelope',
MontoVenta: 2158.3
}
{
_id: 'Modell Rye Bread',
MontoVenta: 2145.7799999999997
}
{
_id: 'Better Chicken Soup',
MontoVenta: 2145.22
}
{
_id: 'Just Right Rice Soup',
MontoVenta: 2143.2
}
{
_id: 'Super Extra Chunky Peanut Butter',
MontoVenta: 2124.94
}
{
_id: 'High Top New Potatos',
MontoVenta: 2117.5
}
{
_id: 'Red Wing Plastic Knives',
MontoVenta: 2115
}
{
_id: 'Carlson Strawberry Yogurt',
MontoVenta: 2081.54
}
{
_id: 'Big Time Beef TV Dinner',
MontoVenta: 2068.39
}
{
_id: 'Gauss Monthly Sports Magazine',
MontoVenta: 2063.4
}
{
_id: 'Horatio Frosted Cookies',
MontoVenta: 2063.1
}
Type "it" for more

Monto de Ventas por Año


db.Ventas.aggregate([
{
$group:{
_id:"$The_Year",
MontoVenta: {$sum: "$store_sales"}
}
},
{
$sort: {MontoVenta: -1}
}
])
{

_id: 2004,

MontoVenta: 1079147.47

}{

_id: 2003,

MontoVenta: 565238.13

5. Monto de Venta por Producto

db.Ventas.aggregate([
{
$group:{
_id:"$product_name",
MontoVenta: {$sum: "$store_sales"}
}
},
{
$sort: {MontoVenta: -1}
}
])
{
_id: 'Hermanos Green Pepper',
MontoVenta: 2370.04
}
{
_id: 'Even Better Large Curd Cottage Cheese',
MontoVenta: 2263.35
}
{
_id: 'Hilltop Mint Mouthwash',
MontoVenta: 2251.64
}
{
_id: 'Carlson Head Cheese',
MontoVenta: 2250.9900000000002
}
{
_id: 'Great Pumpernickel Bread',
MontoVenta: 2244
}
{
_id: 'Fort West BBQ Potato Chips',
MontoVenta: 2203.84
}
{
_id: 'Fabulous Strawberry Drink',
MontoVenta: 2192.25
}
{
_id: 'Hermanos Lemons',
MontoVenta: 2182.76
}
{
_id: 'Moms Foot-Long Hot Dogs',
MontoVenta: 2167.55
}
{
_id: 'Tell Tale Cantelope',
MontoVenta: 2158.3
}
{
_id: 'Modell Rye Bread',
MontoVenta: 2145.7799999999997
}
{
_id: 'Better Chicken Soup',
MontoVenta: 2145.22
}
{
_id: 'Just Right Rice Soup',
MontoVenta: 2143.2
}
{
_id: 'Super Extra Chunky Peanut Butter',
MontoVenta: 2124.94
}
{
_id: 'High Top New Potatos',
MontoVenta: 2117.5
}
{
_id: 'Red Wing Plastic Knives',
MontoVenta: 2115
}
{
_id: 'Carlson Strawberry Yogurt',
MontoVenta: 2081.54
}
{
_id: 'Big Time Beef TV Dinner',
MontoVenta: 2068.39
}
{
_id: 'Gauss Monthly Sports Magazine',
MontoVenta: 2063.4
}
{
_id: 'Horatio Frosted Cookies',
MontoVenta: 2063.1
}
Type "it" for more

Monto de Ventas por Marca

db.Ventas.aggregate([
{
$group:{
_id:"$Brand",
MontoVenta: {$sum: "$store_sales"}
}
},
{
$sort: {MontoVenta: -1}
}
])
{
_id: 'Hermanos',
MontoVenta: 53061.79
}
{
_id: 'Tell Tale',
MontoVenta: 47910.83
}
{
_id: 'Ebony',
MontoVenta: 46387.31
}
{
_id: 'Tri-State',
MontoVenta: 45937.76
}
{
_id: 'High Top',
MontoVenta: 44147.72
}
{
_id: 'Nationeel',
MontoVenta: 42522.17
}
{
_id: 'Horatio',
MontoVenta: 40959.88
}
{
_id: 'Best Choice',
MontoVenta: 39413.36
}
{
_id: 'Fast',
MontoVenta: 37649.74
}
{
_id: 'Fort West',
MontoVenta: 37295.7
}
{
_id: 'Denny',
MontoVenta: 37238.53
}
{
_id: 'High Quality',
MontoVenta: 37023.4
}
{
_id: 'Red Wing',
MontoVenta: 36876.52
}
{
_id: 'Big Time',
MontoVenta: 36585.35
}
{
_id: 'Cormorant',
MontoVenta: 34293.46
}
{
_id: 'Carrington',
MontoVenta: 33523.35
}
{
_id: 'Imagine',
MontoVenta: 32994.38
}
{
_id: 'Sunset',
MontoVenta: 31926.04
}
{
_id: 'Golden',
MontoVenta: 30827.49
}
{
_id: 'Super',
MontoVenta: 30128.97
}
Type "it" for more

You might also like