Mais conteúdo relacionado Semelhante a 2012-05-10 - UG Karlsruhe: NoSQL in .NET - mit Redis und MongoDB (10) Mais de Johannes Hoppe (20) 2012-05-10 - UG Karlsruhe: NoSQL in .NET - mit Redis und MongoDB15. › SET note1:title "Mittag"
› SET note1:message "nicht vergessen"
› KEYS note1:*
› GET note1:title
› DEL note1:title note1:message
63. –
› use WebNote
› db.Notes.save(
{
Title: 'Mittag',
Message: 'nicht vergessen‘
}
);
› db.Notes.save
64. –
› db.Notes.find();
› db.Notes.find({ Title: /Test/i });
› db.Notes.find(
{ "Categories.Color": "red"}).limit(1);
65. –
› db.Notes.update({Title: 'Test'},
{'$set': {Categories: []}});
› db.Notes.update({Title: 'Test'},
{'$push': {
Categories:
{Color: 'Red'}
}
});
66. –
› db.dropDatabase();
› db.Notes.drop();
› db.Notes.remove();
73. NULL NULL
NULL NULL
NULL
74. > db.shapes.find()
› { _id: "1", type: "c", area: 3.14, radius: 1}
› { _id: "2", type: "s", area: 4, length: 2}
› { _id: "3", type: "r", area: 10, length: 5, width: 2}
// Shapes mit radius > 0 finden
> db.shapes.find( { radius: { $gt: 0 } } )
76. blogs: {
author : “Johannes",
date : ISODate("2011-09-18T09:56:06.298Z"),
comments : [
{
author : “Klaus",
date : ISODate("2011-09-19T09:56:06.298Z"),
text : “toller Artikel"
}
]
}
78. blogs: { _id: 1000,
author: “Johannes",
date: ISODate("2011-09-18"),
comments: [ {comment : 1)} ]}
comments : { _id : 1,
blog: 1000,
author : “Klaus",
date : ISODate("2011-09-19")}
> blog = db.blogs.find({ text: "Destination Moon" });
> db.comments.find( { blog: blog._id } );
80. // Jedes Produkt verlinkt die IDs der Kategorien
products:
{ _id: 10, name: "Destination Moon",
category_ids: [ 20, 30 ] }
81. // Jedes Produkt verlinkt die IDs der Kategorien
products:
{ _id: 10, name: "Destination Moon",
category_ids: [ 20, 30 ] }
// Jede Kategorie verlinkt die IDs der Produkte
categories:
{ _id: 20, name: "adventure",
product_ids: [ 10, 11, 12 ] }
categories:
{ _id: 21, name: "movie",
product_ids: [ 10 ] }
82. // Jedes Produkt verlinkt die IDs der Kategorien
products:
{ _id: 10, name: "Destination Moon",
category_ids: [ 20, 30 ] }
// Jede Kategorie verlinkt die IDs der Produkte
categories:
{ _id: 20, name: "adventure",
product_ids: [ 10, 11, 12 ] }
categories:
{ _id: 21, name: "movie",
product_ids: [ 10 ] }
// Alle Kategorien für ein Produkt
> db.categories.find( { product_ids: 10 } )
84. // Jedes Produkt verlinkt die IDs der Kategorien
products:
{ _id: 10, name: "Destination Moon",
category_ids: [ 20, 30 ] }
// Kategorien beinhalten keine Assoziationen
categories:
{ _id: 20,
name: "adventure"}
85. // Jedes Produkt verlinkt die IDs der Kategorien
products:
{ _id: 10, name: "Destination Moon",
category_ids: [ 20, 30 ] }
// Kategorien beinhalten keine Assoziationen
categories:
{ _id: 20,
name: "adventure"}
// Alle Produkte für eine Kategorie
> db.products.find( { category_ids: 20 } )
86. // Jedes Produkt verlinkt die IDs der Kategorien
products:
{ _id: 10, name: "Destination Moon",
category_ids: [ 20, 30 ] }
// Kategorien beinhalten keine Assoziationen
categories:
{ _id: 20,
name: "adventure"}
// Alle Produkte für eine Kategorie
> db.products.find( { category_ids: 20 } )
// Alle Kategorien für ein Produkt product
> product = db.products.find( { _id: some_id } )
> db.categories.find({_id: {$in : product.category_ids}})
103. CODASYL model SQL Agile becoming more Google MongoDB initial
published invented popular BigTable release
IBM’s Oracle Brewer’s Amazon
IMS INGRES founded CAP born Dynamo
1966 1969 1970 1973 1974 1977 1985 1990’s 2000 2004 2007 2008 2009
10gen NoSQL
Codd publishes Term “object-oriented founded Movement
relational model paper database” appears
in 1970 Apache Cassandra
initial release