You are not logged in.
Pages: 1
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
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
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
Online
Thanks for your reply and sorry, i have not restart server after installation of MongoDB.
After restart, it's work fine.
Offline
Pages: 1