MongoDB configuration locally
Application of nonrelational bases
Comparison of relational and non-relational bases
Presentation of mongoDB databases in the Blachotrapez project
Creating backups
Import into the local environment
Inquiries
Aggregations
Bonus - methods of implementation in projects (if there is enough time)
{ _id: <ObjectId1>, username: "123xyz" }
{
_id: <ObjectId2>,
user_id: <ObjectId1>,
phone: "123-456-7890",
email: "xyz@kotrak.com"
}
{
_id: <ObjectId3>,
user_id: <ObjectId1>,
level: 5,
group: "dev"
}
{ _id: <ObjectId1>, username: "123xyz", contact: { phone: "123-456-7890", email: "xyz@kotrak.com" }, access: { level: 5, group: "dev" } }
Social applications
Online advertisement/BI
Archiving Data
Big Analytic Workloads
No specific pattern
Quick save
json :)
Low costs
Async driver - non blocking architecture friendly
Faster than classic relational bases
Takes up a lot of space (in MongoDB 3.x this has been improved)
Deleting documents from the collection does not free disk space
Slow data aggregation
Less efficient with complex queries
mongoexport --db DatabaseName -c collectionName savedFileName.json
Download and instal mongoDB from doc.mongodb.com
Create folder data/db in mongodb/bin
Import file ExceptionLog.json
mongoimport --db TrapeziumDatabase -collection ExceptionLog --drop --file data/db/Exception.log
mongod --dbpath=data/db
db.ExceptionLog.createIndex({Timestamp: -1})
db.getCollection('ExceptionLog').find().sort({Timestamp: -1})
db.getCollection('ExceptionLog').find().sort({Timestamp: -1})
db.getCollection('ExceptionLog').find({Timestamp: { $gte: ISODate("2020-06-10T13:53:42.992Z"), $lt: ISODate("2020-06-12T13:53:42.992Z")}}).sort({Timestamp: -1})
db.getCollection('ExceptionLog').find({ "Details.Message": "Concurrency Exception" })
db.getCollection('ExceptionLog').find({ "Details.InnerException.Source": /Core .Net SqlClient Data Provider/})
db.getCollection('Hangfire.job').find(
{
'Arguments' : {
'$regex' : "http://10.10.10.87:80", '$options' : 'i'
},
'CreatedAt': {
$gte: ISODate("2020-04-16 10:58:29.441Z"), $lt: ISODate("2020-06-16 13:31:52.069Z")
}
})
db.getCollection('ExceptionLog').distinct("UserName")
db.getCollection('ExceptionLog').aggregate([
{$group:
{
_id : "$LogType",
num_logs : {$sum : 1}
}
}
])
db.getCollection('ExceptionLog').aggregate([
{$group:
{
_id: {
UserName : "$UserName",
LogType : "$LogType"
},
num_logs : {$sum : 1}
}
}
])
db.getCollection('Hangfire.job').aggregate([
{$group:
{
_id: {
StateName : "$StateName",
},
num_states : {$sum : 1}
}
}
])