GRIDFS? MongoDB? 16MB ??? ?? ??? ??? ??? ?? ??????. ??? 255kb ???? ??? ? ??? fs.files (?? ???)? fs.Chunks (??? ??)? ?????. ???? ??? ? ????, ?? ?? ? ?? ?? ???? ???? ??????? ???? ??????? ????? ?????. 1. GRIDFS? ????? MongoDB ????? ?? GRIDFS ??? ??? ??? ?????? OpenUploadStream? ???????. 2. ???? ? ? OpenDownLoadStreamByName? ???? ???? ?????? ?????. 3. ???? ???? ?? ??? ?? ? ? ???? .Files Collection; ?? ???? ????, ?? ??? ??? ?? ?? ??? ???, ???? ????, TTL? ???? ????, ??? ?????? S3? ?? ?? ?? ????? ?? ?? ???? ???? ?? ????. ?? GRIDFS? ?? ???? ?? ??? ??? ??? ?? ???? ??? ?????.
??????? ? ??? ???? ?? ???? ? ????. ???? GRIDFS? ???? ????. ??? ?? ??? ??? ?? ??? ???? 16MB?? ? ??? ?????? MongoDB? ?? ??????. ?? ??? ????? ???? ??? ??? ????.

GRIDFS ? ???? ? ??????
GRIDFS? MongoDB? ?? ?? ??? ?? ? ?? ?? (???, ???, ?? ?? PDF)? ???? ???? ?????. GRIDFS? ?? ??? ??? ???? ??,?? ?? ?? (????? ???) (????? 255KB)?? ??? ? ????? ??? ??? ?????.
-
fs.files
: ??? ?? ?? ???? ????? (?? ??, ??? ??, ??? ?? ?). -
fs.chunks
: ?? ??? ??? ?? ?? ??? ???? ?????.
? ???? ??? ????.

- 16MB?? ? ??? ?????.
- ?? ?? ???????? ?? ??? ??? ???????.
- ?? ???? ??? ??????.
- ?? ????? ??? ??? ??? ????? ?????.
?? : GRIDFS? ?? ??? ??? ????. ??? ?? ??? ?? AWS S3 ?? Minio? ?? ?? ?? ???? ? ???? ? ????. ??? ?? MongoDB? ???? ?? ??? ??? ???? GRIDFS? ?????.
GRIDFS? ???? ??? ???? ??
MongoDB ?, ?? ???? ?? mongofiles
? ?? ??? ?? GRIDF? ??? ? ????. ??? Node.js ????? ???? ????.? ????? ?? ??? ??????.

1. MongoDB ????? ??????
NPM MongoDB ??
2. ??? ???????
const {mongoclient} = ?? ( 'mongodb'); const fs = ?? ?? ( 'fs'); Async ?? uploadfile () { const client = new mongoclient ( 'mongodb : // localhost : 27017'); ?????? ????? .connect (); const db = client.db ( 'myapp'); const ?? = ??? mongoclient.gridfsbucket (db, { BucketName : '???'// ?? ?? : ????? 'fs' }); const filestream = fs.createreadstream ( 'large-Video.mp4'); const uploadstream = bucket.openuploadstream ( 'my-video.mp4', { ContentType : 'video/mp4', ?? ??? : {?? : 'John Doe'} }); filestream.pipe (??? ???); uploadstream.on ( 'finish', () => { Console.log ( '?? ??? ? ??'); client.close (); }); } uploadfile ();
? ?? :
- MongoDB? ?????.
- GRIDFS ??? ???? (??? ??? ? ????. ????
fs
). - ? ??? ??? ?????? ??? ??????.
- ?? ??? ? ??? ??? ?????.
GRIDFS?? ??? ???? ??
??? ?? ???? ??????? ?? (? : ??? ?? ?? ?? ????? ??) ?????.
1. Filename?? ??? ????????
Async ?? downloadfile () { const client = new mongoclient ( 'mongodb : // localhost : 27017'); ?????? ????? .connect (); const db = client.db ( 'myapp'); const ?? = ??? mongoclient.gridfsbucket (db, {bucetName : 'uploads'}); const downloadStream = bucket.opEndownLoadStreamByName ( 'my-Video.mp4'); const filestream = fs.createWritestream ( '????-??? .mp4'); downloadStream.pipe (filestream); filestream.on ( 'finish', () => { Console.log ( '??? ????? ???? ?'); client.close (); }); } downloadfile ();
????? MongoDB?? ???? ?? ??? ?????? ?? ?? ???????? ??.
2. ?? ??? ??????
const files = db.collection ( 'uploads.files'). ?? ({}). toarray (); files.foreach (file => { console.log (`filename : $ {file.filename}, size : $ {file.length} bytes`); });
?? ?? ? ?? ??
- ???? ?? ??? ?? ???? ?????? : ?? ?? ? ??? ??????.
- ??? : GRIDFS?
files
????filename
?uploadDate
???? ??????. ?? ????? ?? ???? ?? ??? ?? ???? ??????. - ?? ??? ????? : GRIDFS?? ?? ??? ????. ?? kb? ??? ???? ????. ?? ?? ???? Base64? ??????.
- ?? ?? : ???? 255KB???. ?? ?? ??? ??? ? ??? ??? ???? (? : ?? ??? ??) ? ??? ? ????.
- ?? : ?? ??? ???? ??????. GRIDFS? TTL ???? ???? ??? ???? ???? ???? ????.
???? ? ??
GRIDFS? ? ????? ??? ???????.
- S3 ????? MongoDB Atlas : ?? ????? S3? ?????? MongoDB?? ??? ??????.
- ?? ?? ??? : S3, Google Cloud Storage ?? Minio? ??? ?? ??? ?? ? ??? ?????.
??? ???? ?? ?? ????? ????? ???? ???? ???? GRIDFS? ?????.
GRIDF? ???? ?? ????? ??? ???? ????. ? ??? ???? ???? ?????? ?? ???? ???? ??????. ??? ?? ??? ???? MongoDB? ??? ?? ???? ????.
? ??? ?? ??? ???? ???? ?? MongoDB GRIDFS ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Stock Market GPT
? ??? ??? ?? AI ?? ?? ??

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

useProperIndexesonQuery, ?? ? ???? ??, CompoundIndexeswithequeforeRangefields, andavoidover-indexing? ?????

?? ??????? ????? node.js, socket.io ? mongodb? ??????. ?? ?? ??? ???? ??? ? ?????? ??? ??? ??????. Mongoose? ???? ???? ???? ???? ???? ?? ???? ??????. ?? ?? Socket.io? ?? ???? ?? ???? ????? ???? ??? ?? ??? ?????????. ?????? ? ??? MongoDB? ???? ?? ?? ???? ?? ????. ??? ?? ? ??? ???? ?? MongoDB ??? ???? ???? ???? ???? ???? ?? ??? ?? ?? ???? ?? ? ?? ??????????. Mongodbatlas Cloud ???? ?? ?? ? ??? ???? ??? ? ?? ? ???? ???? ????? TTL ???? ???? ?? ????.

mongodb ?? ?? ?? ??? ???? ???? ?? ( "executionStats")? ??????. ??? TotalDocsexAmined? TotalDocSreturned?? ?? ??? ?? ?? ????. 2. CollScan? ?? ??? ??? ???? ???? ????????. 3. ?? ? ??? ?? ??? ?? ? ??? ???? ?? {status : 1, createat : -1}? ?? ?? ???? ?? ???????. 4. ExecutionTimemillis? 50-100ms? ????? ???? ???????? ?? ??? ???? ????. 5. Indexonly? ?? ??? ?? ??? ??????.

TTL ???? ?? ? ??? ???? ??? ? ??? ??, ?? ? ?? ?? ?? ???? ?????. ?? ??? ???? ??????, expiregterseconds? ??? ??? ??? ????? ?????? ???? ???? ????? 60 ??? ?? ??? ?????.

Designaroundaccesspatternsbyusingaflexibleschemawithembeddeddocumentsforperformance;includecommonfieldslikename,price,andsku,embedvariantandreviewdatawhenpractical,usearraysforspecifications,indexkeyfields,andseparatehigh-volumereviewstoensurescalabi

ShardingIssentientalforscalingmongodbwhendataexexsingsingle-servercapacityorthroughputlimits, enablinghorizontcalingbydatacrossmultipleshards.2.ashardedclusterconsistsofshards (datastorage), Mongosrouters (queryrouting) ? conconfigservers (and configserver)

????? ????? ???? ?? ??? ???, ??? ??? ? compression.usecompactSchemaswithfieldNamesandAptropriatedatatypes, embeddatawisely, andavoidunboundedArrays.Leverage 'sssnappyOrzlibressionTucedISku

MongoDB? ?? ???? ???? ?? ??? ????, ?? $ regex ??? ?? JavascriptRegexp ??? ?? ?????. 2. db.users.find ({name : {$ regex : "john", $ ?? : "i"}})? ???? ?? ??? "John"? ???? ?? ?? ??? ??? ??? ?????. 3. DB.users.find ({email : /.* \. com $/i})? ?? JavaScript ?? ??? ???? ".com"?? ??? ???? ?? ? ?? ????.
