#1 Re: mORMot 1 » TSQLRest Storage GetJSON MongoDB » 2014-11-27 13:34:35

but i can give him like an WHERE clause to update the document ?
Because the update only use the id as reference

#2 Re: mORMot 1 » TSQLRest Storage GetJSON MongoDB » 2014-11-27 12:00:21

Yes correct wink i did it now but i have some id conversion problem

i think its because of the init32 fID

like

Client.Retrieve('kgs22 = '+chr(39)+'0832702300000100000200'+chr(39)+'', R);
R.kgid := '1';
(Client.Server.StaticDataServer[TSQLORM] as TSQLRestStorageMongoDB).Update(R);

R has the id = 54758

but the document in the mongodb has this object id

"_id" : ObjectId("54758b55d499de70714dae2e"),

so this b55d499de70714dae2e is missing

and the update command dont work properly. Any Idea ?

#3 Re: mORMot 1 » TSQLRest Storage GetJSON MongoDB » 2014-11-27 09:52:34

I thought i need to define the record to fetch the data from MongoDB to directly access it , i want to display this Record,(Table) in my cxGrid

if i run   Coll.FindDocs('{kgs22: /^10/}',[],fValues,null); as Example
and do
     jsonArray:= VariantDynArrayToJSON(fValues);
     DataSource1.DataSet := JSONToDataSet(self, jsonArray);

to fil my Dataset i can display me all Data correctly but cannot modify on the fly, this is reason why i tried the ORM way , may this is not correct  smile


Edit:

found out big_smile

i miss typed one defintion of my property smile

#4 Re: mORMot 1 » TSQLRest Storage GetJSON MongoDB » 2014-11-27 08:49:02

Hey AB,

i tried with adding an Integer Value into my document and setup as primary but i get the same message column concern 18<>19  sad

if you can help me with an example , would be nice..

Thank you

#6 mORMot 1 » TSQLRest Storage GetJSON MongoDB » 2014-11-25 13:27:08

mynotos
Replies: 10

Hello Again ,

i have another problem with the function GetJSONValues()


TSQLORM = class(TSQLRecord)
  private
    fid: RawUTF8;
    fx_koordinate,fy_koordinate: RawUTF8;
    fkgs22: string;
    fhausid: RawUTF8;
    fhh22: RawUTF8;
    fjsn_01: RawUTF8 ;
    fdsh_02: RawUTF8 ;
    fjkn_03: RawUTF8 ;
    fjkh_04: RawUTF8 ;
    fjpm_05: RawUTF8 ;
    fmsn_06: RawUTF8 ;
    fdkn_07: RawUTF8 ;
    fmfh_08: RawUTF8 ;
    fdfm_09: RawUTF8 ;
    fmkh_10: RawUTF8 ;
    fmph_11: RawUTF8 ;
    fzon_12: RawUTF8 ;
    fson_13: RawUTF8 ;
    fsph_14: RawUTF8 ;
    fgeom: RawUTF8 ;

  published
    property kgs22: string read fkgs22 write fkgs22 stored AS_UNIQUE;
    property hausid: RawUTF8 read fhausid write fhausid;
    property hh22: RawUTF8 read fhh22 write fhh22;
    property JSN_01: RawUTF8  read fjsn_01 write fjsn_01;
    property DSH_02: RawUTF8  read fdsh_02 write fdsh_02;
    property JKN_03: RawUTF8  read fjkn_03 write fjkn_03;
    property JKH_04: RawUTF8  read fjkh_04 write fjkh_04;
    property JMP_05: RawUTF8  read fjpm_05 write fjpm_05;
    property MSN_06: RawUTF8  read fmsn_06 write fmsn_06;
    property DKN_07: RawUTF8  read fdkn_07 write fdkn_07;
    property MFH_08: RawUTF8  read fmfh_08 write fmfh_08;
    property DFM_09: RawUTF8  read fdfm_09 write fdfm_09;
    property MKH_10: RawUTF8  read fmkh_10 write fmkh_10;
    property MPH_11: RawUTF8  read fmph_11 write fmph_11;
    property ZON_12: RawUTF8  read fzon_12 write fzon_12;
    property SON_13: RawUTF8  read fson_13 write fson_13;
    property SPH_14: RawUTF8  read fsph_14 write fsph_14;
  end;

this is how i define my record, and this i used in my function


Model := TSQLModel.Create([TSQLORM]);
Client := TSQLRestClientDB.Create(Model,nil,':memory:',TSQLRestServerDB);
if StaticMongoDBRegister(TSQLORM,Client.Server,fDB,'kgs22')=nil then
   raise Exception.Create('Error');
R := TSQLORM.Create;
Client.Retrieve('hausid = 5797471', R);

But i get an Exception like

TSQLRestStorageMongoDB.GetJSONValues(TSQLORM): column count concern in row 17<>18'

i dont know why?

the document in my mongodb is this:

{
    "_id" : ObjectId("54660a144c79e2c5b12fe321"),
    "kgs22" : "0531400011000001000300",
    "hausid" : 5797471,
    "x_koordinate" : 50.7385620117187,
    "y_koordinate" : 7.0974899291992,
    "hh22" : 0,
    "JSN_01" : "",
    "DSH_02" : "",
    "JKN_03" : "",
    "JKH_04" : "",
    "JPM_05" : "",
    "MSN_06" : "",
    "DKN_07" : "",
    "MFH_08" : "",
    "DFM_09" : "",
    "MKH_10" : "",
    "MPH_11" : "",
    "ZON_12" : "",
    "SON_13" : "",
    "SPH_14" : "",
    "geom" : "POINT(790088.964828841 6575178.01401502)"
}


do i need to define ID field?


Edit:

line 765:
     while (row.Item.Data.DocList^<>byte(betEof)) and (col<colCount) and
            item[col].FromNext(row.Item.Data.DocList) do
        inc(col);
      if col<>colCount then


on mormotMongoDb shows me different column numbers , so must be something to do with me definitions of the record

#7 Re: mORMot 1 » MongoDB FindDocs Method » 2014-11-24 13:13:13

Oh you're right smile i dont use TVariantDynArray i used as Variant smile now its working fine  smile


other question is this result i want to store in a DataSet like TClientDataSet  from delphi

i used JSON

JSONToDataSet(ClientDataSet1,fValues);

do i need to do more ?

i cannot find an example in usage of this smile

Thanks in Advance

#8 mORMot 1 » MongoDB FindDocs Method » 2014-11-24 10:23:42

mynotos
Replies: 3

Hello Community ,

i'm very happy to find the mormot Framework with MongoDB, its faster and easy to access. But i have one Problem with the FindDocs method

Coll.FindDocs('{kgs22:?}',['/^05314/'],res,null);

When i try to compile it gives me an error like

[DCC Fehler] Unit1.pas(242): E2250 Es gibt keine überladene Version von 'FindDocs', die man mit diesen Argumenten aufrufen kann

that there doest exist FindDocs method with this Arguments

if i look at source there are 2 overloaded functions with the same name , so normally it should not be the problem...

i tried also to seperate this 2 functions but this dont work too


may someone can have a hint or can help me ?=

Board footer

Powered by FluxBB