BDA Assignment5

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Name Ayodhya Mo han She

Ro 1 No: B-5
Asignment No-5.
. 1
Descibe key Feahure of
9schema -less Daabaje
Mongo DB.
Tisfheqenera eaure povidel by the Mongo DB
ASChema-ess olb mcans ne collecli on ho lof
oli ffcrent ype of documeoly in t po in ohc
words in he mongoDB d a
single collcc io
Can hold mulhple documenS and these do (ymenb
fmay Co nsis the eliff no offields,
Size 1t s
onto?
not
oecess 9Yy ha he one documen}
SStmilar to andhe r docyment ike in he e lahonad
db. Dute to this cool fcokut Mongo DB p o v ides
pyo
9preate ftextbili hy db
T h e Docume ot Data Model Doument Oien ted
MongoDB all
the dala sto r d in doc 4me ots
nstcad of tables fike in RDBM5. t o thtse dorymen ,
the data is Storeol i n fields Keyvadu e) pauir inStead
Of rowS and colu nS tw hich make the data muchb
OT fiexibICin co mparison fo RDBMS nd Cach
oment Contains itsu0ique object îcd.
Tdexing
To MongoDB db eve Held in the documentsis
jodexed with prima ndary in dices this
makes easie and takey less Fime
ime to gc SY Sea Ch
eata ro m the the data. Tf
poo of the dota
s 0o in dexed Then db Seach
, each oocme ot
twith the 5pecihedqyerywhich takey lo ts of
ime Qocl nst So eficient

Scalabilityi
MongoDB povides hoi zo nta sca/cahi ity ith
c ih the
helps of at sharding.3hqsding mean fo dsibuhe
data o0 muliple SelveS ,hcC alarge arnoynt
f deta is parhhoned into dalo chunks using the
Sha's ed koy qnd hese data chunks a r e eveolly
diSibued a Cro35 9hards ha eside QtTOSS
many phys Cal seveNs. will also add nC
maChies to arunoing db
RepliCaHon
Mon9o DB
provicdes high avoilability and Tednda0
i th
twith fhe
y
help ofcpli Cahion, it Cr col roulhpl
Copies of daa and Sends these topieto a
diff sCVeSo ha i OC ers
erS fails h
1he daBa sedrieved 1o anothe Sert ve
Aggregoion
TH allows o pe Fofm operg ali10ns t h e guoup ed
ata ancd ge sin11e esul1 (ompuled or

sesult Similar o the .SQL G RoUPBY cloust


1 P0vid ej 3 dilf.
g9eqwions
P1peioc map 'cdute tuncho0 and Single purpose
aggrcqahon mdhods.
Hiqh Penformanie
The per formanee of
Mongo D verry high and
dalq porrsísente as o m pav ed 4o a0ath er db due
o is fcolurrs e Stalabtlity 10dcxing cpli(ohon

.2 Houw do es MonqoD psovides daahase seplicaion?


Exploo i h suilable diagram
Repli caio S the roCeSS of Syncho1)iZ!n
Mulhple serg ves 5
Rtpli calioo pravide 'edundoanoy an nurtaes dotfe
data dvallaubi liy eith dola on
foulliple copie o f
diffevent olb Serg vc
6f Teplit a itd.
Mong oDB achieves eplicaioo b he we

of tta h ost ithe


S
gop mongod inslancej
Sqme daa set
One odde ns dee had
Cceives adl wile 6Persotions
heinstances 3uch as sCcoNdan pply
opesal o03 D6 he primary 3o that they hor
he Same dote set Replica Sc Ca
One p imary node
RepliCa Sc13 9TouP of o 1 mor nodej
Cgen eralIy roinimym 3 node ar req wred
o epliCo
ode 9ne St node Is Pmnoy
node md Cmal D109 nodey qe secondaT
data replicatej som prnmqry to seco nd dry
ode
t the hoe of 0womahic foilovtr OT mainten ance ,
elccHion establis hes for pmmaTY nd
is elected.
Afte the cco ver y of foiled node,it aqo e
join fhe plica se Ond work as secondary node.
A diagra m of
ypi Cal monoDB Tepli cotio S
Show in cohich client Lpp
cLppl alolucuy 10teract with
the Pmmany node and the pnmaTy node then
TCplicoae he daa to fhe secondary nodes
clie nt APplicaia
Di ve
ites ReadS

pmnaY
ReplaHon. Rep icaHon

Second a Secon dao


RepliCas Set Features
A cluste of N nodes
Any node Can be
pimgY
A wite operahons go fo
AutomaHC
po1masy
Fallover
Auto moti
ccovey
OnseO SUS ele chon of Potmamy
.3 Writ shoTt Note on
On

a)Iosevt
This com mand is
S Usedto insert document too a
Collection
Syntax
db. Collechion-Name .insext Cdocyment)
Example
db useaS. insestEI
1 bje ctTd C" 56 7A91elloclg 7cderkoea
hte MonqoDB
DBOveiew".
desmp Hoo " Mo ngoD8 i50o SQL Dg
likes l00

le Result ( 'n Tn)ts ted"13)


Updaing document
MongoDB updac) qod Sdve ()methods qr uyed to
pdaedocumen oto acolecHion
The updale ) ehod pdates Hhe values
exishing in
doumenft while the
h e Save ( mehod neplatess the
eis Hng ymenE h the doCument passed ioSqve )
Syntax
d collecHonna me update ( seleckHonciteria updated
Data
Fxample
db.mycoisupdae HHe 'Ma ngoDB Overvie J, s t t
:hHC:Ne MlonqoD8 Tuoriad J})
Syntax
dbCollechon-me save i-jd'0bjecttd co,Neualaa )
Example
cb myco.. Save C

-id 0bjecttd ("So7 ed 83pq r Je 66oea)


iHe Tutoriols foint Me To pic
"by Tuto7als poio-
Operator Updake
The follouaing modifiers are qvoiloble to upda
perafions e9 n db: co llechon. up dol () and
dnd
b colleci
ooFind An d Modit
De fines the
operalor expression in the dotument o the
fom.
Koperator|> fiel d >:<ValueI> ..3
operoBo fidd Value2

4
UpdaingComplex daa
0an update he Complex daa follo Ir.
Cmd
Co ecion. tpacae-6 Updae One
CollecHon. UpdaeMaoy
CollecHon Replare One

Delei nga Daba


YemoveC) nehod is useol CMOe lo Cy en t
om collectron
Tt Co otains 2 parq meltas
delehon Cii toria a oxding to docym ens till be cmovcd
Justone f Se to sue oY 1, fhen cmove On Onc
documeot.
Sotax
db- co I1echionname move Delehoo-(1 em a, iust0 ne)
Example
db.mycol. rcmo ve i 'HHe:fon1o DB J, 1)
Explain uey wih Syntax and Suwable Cxamplc.
ICeoe
e fo Cahng
Colleclion DB
ntax
Use Daubajengme

Example
>we mdb
2 Iosext
nax
db Collectionoame insert l doyment)
db CotlechonoCme. insert
Exampe
dbusenS. insesl
Objec{1 d c 5o7fhle8lo c13729de860ea,
itle "Mo ngo DB

3 Find
wed o selcc docum ents in a colle chion and eturn
O
Curso to he seleckd coments.
Synax
olb (o llcchon..nqme, find 0
Example
dbusens fincd )
dnop C1
used o
d1op exis tiog lafabaue
S10fax dopDaabase ()
SConditionau Update
Used foY updatiog
Syntax
Jb collectHon na me . tind Ooe Aod Upd ate (seecion cmteia
updaled-dauta)
db-collechoon.ame updateOne C«Alk>updake
olb Collec hon_agme. updotel)any filk?, Upcdate>)
EXample
dempsod O.oe Apd Updale
I fixst0ame Radhika
se Age 30 em.ail

ixstname ' Radhika"

Last_name" shgxma
3
2 db emp. tOeeA-Updale One

iacknouled ged te'matthedlount


)1

modihied Couot
6) limit
limi C ued Fox limi
documens ha you 00of ecoTds Oy
wJan
Sntax HYsO limiEC)
0
db. Collechootld me.find&query)li mit
7750t soumbe )
wed to speciies The Orde io which
etusns the matchin documents the e y
qey
fsom
Collection the9)ven
Syntax bollecHon 0om.eSoxt1field
pame II)
a99tgae-
Use o f0ey he dala e co1ds Ldocuments
Computed slt
Syotas
Operchon)
db callection. name atgate (Agqregar
Examele

tismcol.aggtae CE 2-id
TIS 930up by-
Oututoial 2sum 31)
St lgqq ak exptssi on
irs e-
sum 10v min max push

wie shoa1 notc on,


Dacument in mongodb
Adocy.ment Set ofkey-value paus
Document h hdve ynamlcSchema

3Chem.a meaos that olo.cument n the


ynom
Co lle chioo do no1 need hqe the Same
Samc
se f field Os Shychye dod Commoo fielol 10
a c a |1eHun ' s d c m e may holels if ype oF
daa
2 Collechon
ollecHoniS4
9oup0t mangodb docume n s 1 t is a

eta_e2 ulvaltot_0
00RDBNS. ables
doukabaes.
A Coliecon exists cwithina Single
aSchema
CollecHoo do not_enforce
clotu.me.nts
nts_ithina collechon Can have diff
-
ields
ypicaullyall dacu.mens incallechionsQe ut
Simila O elated Purpse
CCreahnq the losge Collechon and ange quey
Usin9 follo09 Sntax Lwe Can CrEcoe Colltc11
Syntax
db.reate ollecHon Cnameop tions
Example
db eate Cóllection myCollech on

You might also like