summaryrefslogtreecommitdiff
path: root/client/gridfs.cpp
diff options
context:
space:
mode:
authorDwight <dmerriman@gmail.com>2009-02-09 15:38:26 -0500
committerDwight <dmerriman@gmail.com>2009-02-09 15:38:26 -0500
commit8cb17548c27a6599641fb7319f838e1f489745a2 (patch)
treedbd07475958c450d5fa20ab5c652fc01c2a298ec /client/gridfs.cpp
parent147948c7b33d4542a99352dd02ec3cb88f401a7c (diff)
downloadmongo-8cb17548c27a6599641fb7319f838e1f489745a2.tar.gz
bsonobjbuilder cleanup
Diffstat (limited to 'client/gridfs.cpp')
-rw-r--r--client/gridfs.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/client/gridfs.cpp b/client/gridfs.cpp
index 987f6c49b51..bd17894f7b2 100644
--- a/client/gridfs.cpp
+++ b/client/gridfs.cpp
@@ -10,7 +10,7 @@
namespace mongo {
- const gridfs_offset DEFAULT_CHUNK_SIZE = 256 * 1024;
+ const unsigned DEFAULT_CHUNK_SIZE = 256 * 1024;
Chunk::Chunk( BSONObj o ){
_data = o;
@@ -19,7 +19,7 @@ namespace mongo {
Chunk::Chunk( BSONElement fileId , int chunkNumber , const char * data , int len ){
BSONObjBuilder b;
b.appendAs( fileId , "files_id" );
- b.appendInt( "n" , chunkNumber );
+ b.append( "n" , chunkNumber );
b.appendBinDataArray( "data" , data , len );
_data = b.obj();
}
@@ -47,7 +47,8 @@ namespace mongo {
{
BSONObjBuilder b;
b << "filename" << filename ;
- b << "length" << length ;
+ massert("large files not yet implemented", length <= 0xffffffff);
+ b << "length" << (unsigned) length ;
b << "chunkSize" << DEFAULT_CHUNK_SIZE ;
OID id;
@@ -102,7 +103,7 @@ namespace mongo {
_exists();
BSONObjBuilder b;
b.appendAs( _obj["_id"] , "files_id" );
- b.appendInt( "n" , n );
+ b.append( "n" , n );
BSONObj o = _grid->_client.findOne( _grid->_chunksNS.c_str() , b.obj() );
assert( ! o.isEmpty() );