Page 1 of 1
MongoDB. TUniQuery error: Invalid namespace specified '.Session'
Posted: Wed 12 Sep 2018 01:10
by Raul
Hi
I have a source code in DelphiXE4 very tested against MongoDB 3.6.5. It works without any issue against that version. Now, doing some tests with Mongo 4.0.0 I get the error of the subject "Invalid namespace specified '.Session'"
Here is the data:
- UniDac version: 7.3.9
- Query.SQL.Text: {"Id":"20180911190000","User":{"Id":784,"OfficeId":4,"CounterId":0,"WorkCityId":0}}
The code looks like this
Code: Select all
...
Query := TUniQuery.Create(nil);
try
Query.Connection := Connection;
Query.SQL.Text := SQLText;
Query.Execute;
finally
Query.Free;
end;
...
Am I doing anything wrong? Are there any compatibility issue?
Kind regards!
Raúl
Re: MongoDB. TUniQuery error: Invalid namespace specified '.Session'
Posted: Wed 12 Sep 2018 12:53
by azyk
The current version of UniDAC 7.3.9 does not support MongoDB 4.0.0. Therefore, you get the specified error. Currently, support for MongoDB 4.0.0 in UniDAC is under development. We will let you know when the additional information appears.
Re: MongoDB. TUniQuery error: Invalid namespace specified '.Session'
Posted: Tue 18 Sep 2018 08:45
by azyk
We tested UniDAC for compatibility with MongoDB 4.0.2. UniDAC 7.3.9 does not support new capabilities yet, which appeared starting from the version MongoDB 4.0. Support for these features is still underway.
At the same time, UniDAC 7.3.9 supports all features of MongoDB 4.0.2, which are present in MongoDB 3.6.
To avoid the "Invalid namespace specified '.Session'" error, use MongoDB client libraries distributed with UniDAC. 32-bit libraries are located in the 'Bin\Win32\' subfolder relative to the folder where UniDAC was installed. 64-bit ones in the 'Bin\Win64\' subfolder. For example:
Code: Select all
UniConnection1.SpecificOptions.Values['MongoDB.BSONLibrary'] := 'C:\Program Files (x86)\Devart\UniDAC for RAD Studio XE4\Bin\Win32\libbson-1.0.dll';
UniConnection1.SpecificOptions.Values['MongoDB.ClientLibrary'] := 'C:\Program Files (x86)\Devart\UniDAC for RAD Studio XE4\Bin\Win32\libmongoc-1.0.dll';
UniConnection1.Connect;
To add a document to the collection, use the Database Command insert:
https://docs.mongodb.com/manual/referen ... nd/insert/ . For example:
Code: Select all
UniQuery1.SQL.Text := '{insert:"test", documents:[{"Id":"20180911190000","User":{"Id":784,"OfficeId":4,"CounterId":0,"WorkCityId":0}}]}';
UniQuery1.Execute;
To read this document from the collection, use the Database Command find:
https://docs.mongodb.com/manual/reference/command/find/ . For example:
Code: Select all
UniQuery1.SQL.Text := '{find:"test", filter:{Id:"20180911190000"}}';
UniQuery1.Open;
Re: MongoDB. TUniQuery error: Invalid namespace specified '.Session'
Posted: Thu 24 Jan 2019 12:49
by seamus10
The present form of UniDAC 7.3.9 does not bolster MongoDB 4.0.0. In this way, you get the predetermined mistake. At present, bolster for MongoDB 4.0.0 in UniDAC is a work in progress. We will tell you when the extra data shows up.
MongoDB Tutorial
Re: MongoDB. TUniQuery error: Invalid namespace specified '.Session'
Posted: Thu 24 Jan 2019 14:40
by azyk
We are currently updating UniDAC with the support for the new features of MongoDB 4.0.0. Please specify the new features of MongoDB 4.0.0 you need the most:
https://docs.mongodb.com/manual/release-notes/4.0/