Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
BSON size with C driver
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
sptrakesh  
View profile  
 More options Oct 3 2012, 6:52 pm
From: sptrakesh <rakesh.vidyadha...@gmail.com>
Date: Wed, 3 Oct 2012 15:52:27 -0700 (PDT)
Local: Wed, Oct 3 2012 6:52 pm
Subject: BSON size with C driver

Hello,

This was posted to the BSON group<https://groups.google.com/forum/?fromgroups#!topic/bson/aKr6CPiGIyI>,
but no one has viewed it yet, so cross-posting here in hope that some one
can help.

I am working on a standalone BSON C++ API<http://kenai.com/projects/mongoviewer/sources/svn/show/bson?rev=106>.
 At present I have a couple of issues with my BSON serialiser, so am using
the C API to generate the bson.  I do not see any functions to set the size
(the first 4 bytes of the document/sub-document as per spec) of the BSON
data, neither could I find anything appropriate in the test suite for the C
driver.  bsondump generates the following error trace when I use it to read
my test bson output

It may be that my logic is false when generating the BSON.  The basic
workflow is as follows:

::bson b;

bson_init_size( &b, document.getSize() );

// iterator over elements in document and based on element type invoke appropriate bson_append_xxx functions

bson_finish( &b );

bson_destroy( &b );

bsondump /tmp/doctest.bson
{ "_id" : ObjectId( "506b931b44c193650000feff" ), "double" : 1, "string" :
"string value", undefined, "boolean" : true, "date" : Date( 1349209034000
), "null" : null, "regex" : /^abc/, "integer" : 1, "long" : 2 }
Wed Oct  3 09:39:22 Assertion: 10334:Invalid BSONObj size: 0 (0x00000000)
first element: EOO
0x107aa3dd9 0x107aaa67e 0x107a5a93f 0x107d7ba30 0x107d7d85c 0x107d7b475
0x107d79063 0x107d7ce21 0x7fff8c2667e1
 0   bsondump                            0x0000000107aa3dd9
_ZN5mongo15printStackTraceERSo + 57
 1   bsondump                            0x0000000107aaa67e
_ZN5mongo11msgassertedEiPKc + 350
 2   bsondump                            0x0000000107a5a93f
_ZNK5mongo7BSONObj14_assertInvalidEv + 847
 3   bsondump                            0x0000000107d7ba30
_ZN5mongo8BSONTool11processFileERKN5boost11filesystem210basic_pathISsNS2_11 path_traitsEEE
+ 1184
 4   bsondump                            0x0000000107d7d85c
_ZN8BSONDump5doRunEv + 1212
 5   bsondump                            0x0000000107d7b475
_ZN5mongo8BSONTool3runEv + 997
 6   bsondump                            0x0000000107d79063
_ZN5mongo4Tool4mainEiPPc + 9427
 7   bsondump                            0x0000000107d7ce21 main + 49
 8   libdyld.dylib                       0x00007fff8c2667e1 start + 0
assertion: 10334 Invalid BSONObj size: 0 (0x00000000) first element: EOO

Any idea what I am missing when using the C API for serialising to BSON?

Thanks
Rakesh


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
sptrakesh  
View profile  
 More options Oct 5 2012, 10:37 am
From: sptrakesh <rakesh.vidyadha...@gmail.com>
Date: Fri, 5 Oct 2012 07:37:29 -0700 (PDT)
Local: Fri, Oct 5 2012 10:37 am
Subject: Re: BSON size with C driver

Any recommendation on the proper way to generate a valid BSON document
using the C API?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions Older topic »