Store PDF into MongoDB with C# REST API and Display in Angular 6 Web App

Gul Ershad
3 min readDec 14, 2018

Introduction

MongoDB is an outstanding NoSQL database for the unstructured data and provides more performance out of the system by eliminating lots of stuff like log shipping, referential integrity that Relational Database System (RDBMS) enforces by default. It can store different types of data like binary, stream, JSON, text, etc.

Architecture to Store PDF into MongoDB and Display on Angular 6

MongoDB can store files like PDF, MS-Excel, Word, etc. either in the form of Binary or Stream.

Below Architecture Diagram:

Figure: Store PDF File in MongoDB by using GridFS

Structure and Storage Create by GridFs in MongoDB

GridFs creates two entery into the Database after File upload in the form of Stream or Binary:

  • fs.Files : It stores information like File Name, Chunk Size, Upload Date, etc.
  • fs.Chunks: File Stream or Binary is divided into chunks and stored in this collection.

GridFs creates the below structure into MongoDB:

--

--

Gul Ershad
Gul Ershad

Written by Gul Ershad

A technology explorer with the drive to learn, apply and expand his mind.

No responses yet