The following code works, what it does is: it reads from a buffer and appends to the "s" field in Mongo, but makes a call to the database every time I go through the loop:
bsonData = BSON("$push"<<BSON("s" << BSON("r" << (unsigned int)RecordNumber << "t" << Variant << "u" << TimeStamp << "v" << Value)));
What I would like to do is fill a vector with the 4 values, and insert that vector into the database in one call, I tried this:
for(i=0;i<vRecNo.size();i++)
{
bOB.append("s", BSON("r" << (unsigned int)vRecNo[i] <<
"t" << (unsigned int)vType[i] <<
"u" << (unsigned int)vTimeStamp[i] <<
"v" << (unsigned int)vValue[i]));
}
but creates duplicate "s" field in Mongo. Any help is greatly appreciated, thank you in advance.