#1 Re: mORMot 1 » Return value if some field does not exist » 2016-09-29 17:40:21

Ok, error occurs when some document has different field names than previous.

{
_id:"1",
name:"bob",
age:33
}
{
_id:"2",
name:"somename",
age:31
}

{
_id:"3",
status:"X",
somedata:"ABC"
}

TFields "status" and "somedata" are not generated in tdataset?

#2 Re: mORMot 1 » Return value if some field does not exist » 2016-09-29 06:15:15

I have a collection with 10-12 fields. One document has only 1 field (_id). In this case, an error occurs when using DataSet that I got from ToDataset function (SynVirtualDataSet). (I use it in the DBGrid)

Exception:
00b40373 +00b Project1.exe SynCommons              23440  +5 IdemPropNameU
00b7241c +0dc Project1.exe SynVirtualDataSet         838  +8 TDocVariantArrayDataSet.GetRowFieldData
00b71601 +04d Project1.exe SynVirtualDataSet         414  +4 TSynVirtualDataSet.GetFieldData
006c16a7 +027 Project1.exe Data.DB                           TDataSet.GetFieldData
006afb06 +062 Project1.exe Data.DB                           TField.GetData
006afdf9 +01d Project1.exe Data.DB                           TField.GetIsNull

#3 mORMot 1 » Return value if some field does not exist » 2016-09-29 05:15:34

sanyin
Replies: 5

I have MongoDB collection that contains documents where some fields are sometimes non existing. In that case I want to get a null value.
Using "ToDataSet" to show the result in the datagrid, there is an exception raised (IdemPropNameU).

Also, BSON (synMongoDB) function has a bug, an infinite loop if you specify invalid JSON string e.g. "{something".

Board footer

Powered by FluxBB