You are not logged in.
Completely new to MongoDB and tried one of your old examples:
https://blog.synopse.info/?post/2014/05 … ase-access
Installed the latest version (6.03) of MongoDB
and tried:
var Client: TMongoClient;
DB: TMongoDatabase;
serverTime: TDateTime;
res: variant; // we will return the command result as TDocVariant
errmsg: RawUTF8;
begin
Client := TMongoClient.Create('localhost',27017);
try
DB := Client.Database['mydb'];
writeln('Connecting to ',DB.Name); // will write 'mydb'
errmsg := DB.RunCommand('hostInfo',res); // run a command
if errmsg<>'' then
exit; // quit on any error
serverTime := res.system.currentTime; // direct conversion to TDateTime
writeln('Server time is ',DateTimeToStr(serverTime));
finally
Client.Free; // will release the DB instance
end;
end;
and gets: 'Unsupported OP_QUERY command: db.hostInfo. The client driver may require an upgrade. For more details see https://dochub.mongodb.org/core/legacy-opcode-removal'
Don't know if its possible use the latest version with mORMot1 any more or should I try with mORMot2?
Delphi-11, WIN10
Offline
Yes the mormot 2 driver has been update but not the mormot 1...
Offline
Ok, that's good. As I'm new to MongoDB it also makes sense to start MongoDB with mORMot2.
When I tried to set up mORMot2 on Delphi and followed the instructions from the ReadMe file I got this code to work.
:-)
Delphi-11, WIN10
Offline