You are not logged in.
Hello!
I try to get the documents as "V1" value is greater than "6600" like below:
LColl := FDB.CollectionOrCreate[FMongoCollectionName];
SetLength(ADocs, LDocsCount);
LColl.FindDocs('{V1:{$gt, ?}}', ['6600'], ADocs);
but i've got error message as
"EBSONException : doc.VType = 275"
What's the problem?
Offline
Using Debug, I can see that FindDocs function's argument "Projection" has 275 as VType in the TBSONVariant.FromBSONDocument().
And TMongoRequestQuery.Create() -> BSONWriteParam() -> BSONWriteDoc() executed squentially.
In BSONWriteDoc(),
if TVarData(doc).VType<>DocVariantType.VarType then
raise EBSONException.CreateFmt('doc.VType=%d',[TVarData(doc).VType]) else ===> Exception eraise here
TVarData(doc).VType is 275,
DocVariantType.VarType is 274.
waht's the meaning of 274 or 275 ?
Offline
Thanks your advice.
I've tried as:
LColl.FindDocs('{V1:{$gt:?}}', ['6600'], ADocs);
Same error is occured.
Also as:
LColl.FindDocs('{V1:?}', ['6600'], ADocs, 'V1'); ==> projcetion parmeter is 'V1'
Same thing.
I think that the problem is not the JSON format but the projection parameter type.
When and How to determine DocVariantType.VarType to 274 ?
And Why TVarData(doc).VType is 275 as different to DocVariantType.VarType?
===============================================
According to the code of TMongoRequest.BSONWriteParam() in synMongoDB.pas,
projection parameter treated as BSONVariantType, but when TBSONVariantData(projection).VBlob is null then typecast as TDocVariantData.
And exception occured.
How to aviod this problem?
Last edited by bigheart (2014-09-17 02:46:44)
Offline
I've solved the problem partially.
LColl.FindDocs('{V1:?}', ['6600'], ADocs); ===> Exception occured that "EBSONException : doc.VType = 275"
LColl.FindDocs('{V1:?}', ['6600'], ADocs, 'V1'); ===> Same above
LColl.FindDocs('{V1:?}', ['6600'], ADocs, 'NULL'); ===> **Succeed**
I don't know why succeeded.
Offline
I had already mORMot ver 1.18.
But I have updated from mORMotNightlyBuild.zip just before, So the problem is solevd.
Build number should be displayed as part of filename in the download site, i think.
Also, "Synopse mORMot Framework SAD 1.18.pdf" file should be modified as below at Page 884:
FindDocs('{name:?,age:{$gt,?}}',['John',21],res); ===> FindDocs('{name:?,age:{$gt:?}}',['John',21],res, Null);
Anyway thanks for your efforts and sharing.
Last edited by bigheart (2014-09-17 06:51:46)
Offline
When you download the nightly build, you have the revision number part of the .zip, as root folder.
See e.g. today it is "mORMot_and_Open_Source_friends_2014-09-16_200937_a370968c84"
This a370968c84 is the current fossil commit - see http://synopse.info/fossil/timeline
With modern DVCS source control managers (like Fossil or Git), you do not have an incremental "revision" number, as with SVN.
You have a "hash" of the commit itself, e.g. "a370968c84" in our case.
I have fixed the doc.
Thanks for the feedback!
Offline
Update:
Since this hash should be confusing, SYNOPSE_FRAMEWORK_VERSION constant will now include a per-commit increasing number, e.g. 1.18.259 instead of plain 1.18 version (generated by SourceCodeRep tool into SynopseCommit.inc file), to specify the exact source state.
See http://synopse.info/fossil/info/2fca395ee48
It should help identifying on which source you are working.
Each commit will also include this number, within its description text, e.g. {259}, on both Fossil and Git repositories.
I hope it will reduce the number of issues post on this forum, just because the source used was out of date.
Offline