stijnsanders / TMongoWire

Delphi MongoDB driver
MIT License
102 stars 37 forks source link

Find data using a field #14

Closed johnidm closed 10 years ago

johnidm commented 10 years ago

I need find a data object in mongo using field value "codigo"

An example of what I need can be seen in http://stackoverflow.com/questions/18862117/how-to-find-data-in-mongodb-using-tmongowire/18874253#18874253

Thanks

stijnsanders commented 10 years ago

Have you seen my answer there? Have you tried "db.johni.alunos"? Have you tried to use TMongoWire.Insert and see in the log or the data-directory where the data is stored?

johnidm commented 10 years ago

HI

Thanks for answering.

Yes, I saw your answer but could not solve the problem.

The example is in https://github.com/johnidm/MongoDBDelphiTMongoWire

The research method in this unit "DAO.Aluno.pas" method "Pesquisar".

Thanks

stijnsanders commented 10 years ago

That's odd, why is codigo a string and not integer? Please make it an integer, then try with BSON(['codigo',1]) instead of BSON(['codigo','1']) also, be sure to add at least one document with codigo:1

johnidm commented 10 years ago

hi

this problem is data type, "codigo" is type integer,

Works using BSON (['codigo', 1])

I close issue.

Thanks.