您好,欢迎访问三七文档
mongoDBIt’snotjustaboutbigdata08.09.2011whatismongoDB?“Scalable,open-source,high-performance,document-orienteddatabase”-10genStoragemodel•relational–database–table–row•mongoDB–database–collection–document/object{_id:1234,author:{name:“BobDavis”,email:b@d.com},post:“InthesetroubledtimesIliketo…“,date:{$date:“2010-07-1213:23UTC”},location:[-121.2322,42.1223222],rating:2.2,comments:[{user:“jgs32@hotmail.com”,upVotes:22,downVotes:14,text:“Greatpoint!Iagree”},{user:“holly.davidson@gmail.com”,upVotes:421,downVotes:22,text:“Youareamoron”}]}Documents(a.k.a.Objects){_id:1234,author:{name:“BobDavis”,email:b@d.com},post:“InthesetroubledtimesIliketo…“,date:{$date:“2010-07-1213:23UTC”},location:[-121.2322,42.1223222],rating:2.2,comments:[{user:“jgs32@hotmail.com”,upVotes:22,downVotes:14,text:“Greatpoint!Iagree”},{user:“holly.davidson@gmail.com”,upVotes:421,downVotes:22,text:“Youareamoron”}],tags:[“Politics”,“Virginia”]}Flexible“Schemas”db.posts.find({author.name:“mike”})dynamicqueriesdb.posts.find({rating:{$gt:2}})db.posts.find({tags:“Software”})db.posts.find().sort({date:-1}).limit(10)querylanguage•Predicates–,=,,=–$all–$exists–$ne–$in–$nin–$nor–$not–$or–$and•regularexpressions•$where(jsexps)•group()•**nojoins**db.posts.ensureIndex({author.name:1}indexesdb.posts.find({author.name:“mike”})geospatialindexingandqueriesdb.places.ensureIndex({loc:“2d”})db.places.find({loc:{$near:[50,50]}}).limit(10)db.places.find({loc:{$within:{$box:[[40,40],[60,60]]}}})db.places.find({loc:{$within:{$center:[[40,40],10]}}})Commentc={author:“will@objectlabs.com”,date:newDate(),text:“greatpost!”}db.posts.update({_id:post._id},{$push:{comments:c}})atomicupdatesatomicupdates•operators–$set–$unset–$inc–$push–$pushAll–$pull–$pullAll–$bitaggregationandmap/reduceNativedriversinalmosteverylanguage•Java•Javascript•Python•Ruby•C#•PHP•andmore…BuiltforscalabilityreliabilityfromthegroundupHighperformance,faulttolerantclustersmadeeasy•Replicasets•Auto-shardingBut,mongoDBisnotjustaboutbigdataBlogPostObject-RelationalmappingistheVietnamofourindustry”-TedNeward{_id:1234,author:{name:“BobDavis”,email:b@d.com},post:“InthesetroubledtimesIliketo…“,date:{$date:“2010-07-1213:23UTC”},location:[-121.2322,42.1223222],rating:2.2,comments:[{user:“jgs32@hotmail.com”,upVotes:22,downVotes:14,text:“Greatpoint!Iagree”},{user:“holly.davidson@gmail.com”,upVotes:421,downVotes:22,text:“Youareamoron”}],tags:[“Politics”,“Virginia”]}…vs.thislovelinessmongoDBisagreatgeneralpurposedatabaseGoodusesforMongoDB•accounts/userprofiles•formdata•CMS•storinggeo-data•applicationconfiguration•applicationlogging•…Q&AMoreinfo•MongoDB/10Gen––•MongoLab––will@mongolab.com
本文标题:mongoDB讲解
链接地址:https://www.777doc.com/doc-3640081 .html