How to create MongoDB indexes automatically with Lift Framework?

I am using Lift Framework with Record as ORM and Mongo as database. Then I change used indexes, I go to remote mongo console, and ensure indexes by hand.

I want to automate it so that Lift will ensure indexes at every start of server.

Answers


Anwser was found here:

  1. То do some action on app loading, simply put it in the class definition.
  2. MongoMeta has ensureIndex function which creates index just like MongoDB native ensureIndex does.

Need Your Help

How to add numbers together from a string with words?

python string try-catch add

I'm new to Python and I'm sure that there's a method to do this that I don't know about. I checked around for my question, and there are many similar ones but I didn't find exactly mine.

How to run groovy in Android env?

android groovy

I'm trying to run groovy program in Android. I use: