MongoDB. TUniQuery error: Invalid namespace specified '.Session'

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Raul
Posts: 4
Joined: Sat 28 Apr 2018 00:55

MongoDB. TUniQuery error: Invalid namespace specified '.Session'

Post by Raul » Wed 12 Sep 2018 01:10

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

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: MongoDB. TUniQuery error: Invalid namespace specified '.Session'

Post by azyk » Wed 12 Sep 2018 12:53

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.

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: MongoDB. TUniQuery error: Invalid namespace specified '.Session'

Post by azyk » Tue 18 Sep 2018 08:45

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;

seamus10
Posts: 1
Joined: Thu 24 Jan 2019 12:47

Re: MongoDB. TUniQuery error: Invalid namespace specified '.Session'

Post by seamus10 » Thu 24 Jan 2019 12:49

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
Last edited by seamus10 on Sat 26 Jan 2019 13:32, edited 1 time in total.

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: MongoDB. TUniQuery error: Invalid namespace specified '.Session'

Post by azyk » Thu 24 Jan 2019 14:40

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/

Post Reply