Database Reference
In-Depth Information
GridFS stores data in two collections—in this case, cms.assets.files , which stores
metadata, and cms.assets.chunks , which stores the data itself. Consider the following pro-
totype document from the cms.assets.files collection:
{ _id : ObjectId ( ),
length : 123 ...,
chunkSize : 262144 ,
uploadDate : ISODate ( ),
contentType : 'image/jpeg' ,
md5 : 'ba49a...' ,
metadata : {
nonce : ObjectId ( ),
slug : '2012-03-invisible-bicycle' ,
type : 'photo' ,
locked : ISODate (...),
parent_id : ObjectId (...),
title : 'Kitteh' ,
created : ISODate ( ),
author : { _id : ObjectId ( ), name : 'Jared' },
tags : [ ],
detail : {
filename : 'kitteh_invisible_bike.jpg' ,
resolution : [ 1600 , 1600 ], }
}
}
Note that in this example, most of our document looks exactly the same as a basic page doc-
ument. This helps to facilitate querying nodes, allowing us to use the same code for either a
photo or a basic page. This is facilitated by the fact that GridFS reserves the metadata field
for user-defined data.
Operations
This section outlines a number of common operations for building and interacting with the
metadata and asset layer of the CMS for all node types. All examples in this document use
the Python programming language, but of course you can implement this system using any
language you choose.
Search WWH ::




Custom Search