mongoDB讲解

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

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

1 / 24
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功