gridfs - How to Store Images into Specified Collections in MongoDB -


i know possible save binary files using mongodb using "mongofiles" utility...

is there way store images specified collection, not in db.fs.files??

i want create users collection using store user details along thier profile pic this,

{     "_id" : "usr_1",     "username"  : "willsmith123",     "firstname" : "will",     "lastname"  : "smith",     "status"    : "active",     "image"     : {               "_id"        : objectid("558be8062f194d2587000001")              "chunksize"  : 261120,              "uploaddate" : isodate("2015-06-25t10:20:47.105z"),              "length"     : 25038,              "md5"        : "b1d38a0b2ccde6da71fd6ae8fe2f637f",              "filename"   : "mylogo.png"                   } } 

how can have collection this, maintain relation between users , thier images..

any suggestions.. in advance.

note:

database data

filesystem files

choice matters

use gridfs or else use below stuff

instead of saving embedded document

         "image"     : {                "chunksize"  : 261120,               "uploaddate" : isodate("2015-06-25t10:20:47.105z"),               "length"     : 25038,               "md5"        : "b1d38a0b2ccde6da71fd6ae8fe2f637f",               "filename"   : "mylogo.png"           } 

just save reference of image below

{    "_id" : "usr_1",    "username"  : "willsmith123",    "firstname" : "will",    "lastname"  : "smith",    "status"    : "active",    "imageref"     : "unique id (objectid)" } 

use imageref or set image.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -