#1 2014-05-12 08:42:17

Chris75018
Member
From: France
Registered: 2012-09-14
Posts: 26
Website

MongoDB : unknown collection "system.indexed"

Hello there,

when i use this piece of code for initialized a new MongoDB database

  MongoClient := TMongoClient.Create(Host_ip,27017);
  DB := MongoClient.Database[DTB_name];
  Model := TSQLModel.Create([TMYMODEL]);
  Client := TSQLRestClientDB.Create(Model,nil,':memory:',TSQLRestServerDB);
  try
    if StaticMongoDBRegister(TMYMODEL,
                             Client.Server,
                             DB,
                             DTB_name)=nil then
      raise Exception.Create('Error');

i've got this error : Unknown collection "system.indexes"
only on a new installation of MongoDB server and when a field is marked "AS_UNIQUE" in TSQLMODEL declaration.

But when i used a direct mongoDB database access as in your post http://blog.synopse.info/post/2014/05/0 … ase-access , system.indexes collection is correctly initialized.
So,
- did i must initialized database first with direct access ?
- Is there something wrong in my code ?

Thank´s for your time

Offline

#2 2014-05-12 21:35:05

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: MongoDB : unknown collection "system.indexed"

Are you using latest MongoDB 2.6 revision?

Offline

#3 2014-05-13 07:38:37

Chris75018
Member
From: France
Registered: 2012-09-14
Posts: 26
Website

Re: MongoDB : unknown collection "system.indexed"

Yes I do.
MongoDB version : 2.6.1 (x64-2008 msi)
Windows 8 x64 

I've got same results with Windows server 2008 x64, Windows server 2012 x64 and MongoDB 2.6.1 x32 on Windows XP sp 4.

Offline

#4 2014-05-13 16:25:31

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: MongoDB : unknown collection "system.indexed"

I was not able to reproduce it with a blank MongoDB 2.6.1 database...
But it may happen if the DB is identified as older than 2.6.0...

Could  you please use the IDE on your side, and debug in the TMongoCollection.EnsureIndex() method to see what is potentially wrong?
Normally, you should have fDatabase.Client.ServerBuildInfoNumber returning 2060100, so UseCommand should have been set to true...

But for older versions, I've just fixed what seemed to be wrong.
See http://synopse.info/fossil/info/e4267ce7b6

Offline

#5 2014-05-14 13:37:49

Chris75018
Member
From: France
Registered: 2012-09-14
Posts: 26
Website

Re: MongoDB : unknown collection "system.indexed"

Thanks for your reply and sorry, i have not restart server after installation of MongoDB.
After restart, it's work fine.

Offline

Board footer

Powered by FluxBB