ruby - Is mongoid automatically indexing the field _id? -


i on first experience nosql databases, using mongodb. using ruby-2.2.2 rails-3.2.22 , mongoid-3.17

i've seen mongoid automatically includes _id field in models.

but,

do need manually create index field or automatically created happens activerecord in relational databases?

how can see list of indexes exists each model?

to list of existing indexes should ask inside mongodb console (mongo binary on localhost):

use databasename; db.collectionname.getindexes(); 

where databasename database name , collectionname collection name accordingly. http://docs.mongodb.org/manual/reference/method/db.collection.getindexes/

and yes, mongodb has indexes _id fields automatically. http://docs.mongodb.org/manual/core/index-single/#single-field-indexes


Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -