How to create text index for a collection with mongoose 3.8.9

41 views
Skip to first unread message

Mauricio Mercado

unread,
Sep 11, 2014, 6:43:19 PM9/11/14
to mongoo...@googlegroups.com
Hello,

I want to add text indexes to a collection I call users, but Id like to add that index to several fields, how would I do with mongoose models

Im doing the following:

userSchema.index({ name: "text" }, { weight: 5});
userSchema.index({ name: "email" }, { weight: 2});
userSchema.index({ username: "text" }, { weight: 10});

but it only creates the name text index.

What am I missing?

Thank you
Reply all
Reply to author
Forward
0 new messages