How does ensureIndex work in mongoengine?

223 views
Skip to first unread message

Roy Smith

unread,
Jan 28, 2012, 10:36:48 AM1/28/12
to mongoeng...@googlegroups.com
If you add an index to a Document class's meta, when does that get executed?  Does it call ensureIndex() before every query?  Or just once when the class is first imported?  Or something else?

Alice Bevan–McGregor

unread,
Mar 15, 2012, 2:35:54 PM3/15/12
to mongoeng...@googlegroups.com
On Saturday, January 28, 2012 10:36:48 AM UTC-5, Roy Smith wrote:
If you add an index to a Document class's meta, when does that get executed?  Does it call ensureIndex() before every query?  Or just once when the class is first imported?  Or something else?

+1 on this question.  I'm about to write a migration script to execute ensureIndex, but it'd be nice if this wasn't necessary. 
Reply all
Reply to author
Forward
0 new messages