Since some people prefer "id" to "_id", Salat has an @Key annotation
that can be used to change the name of the field when the object is
serialized (https://github.com/novus/salat/wiki/Annotations).
import com.novus.salat.annotations._
case class Foo(@Key("_id") id: ObjectId)
If you want to index a business key, see http://www.mongodb.org/display/DOCS/Indexes for information about how to create indices on collections. If you
have questions about that, please post to mongodb-casbah-users.
Best,
Rose
On Jun 5, 7:50 am, Zoro <khandra...@gmail.com> wrote:
> Is it possible to mark a field as primary key?
rktoomey
unread,
Jun 5, 2012, 12:15:22 PM6/5/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to scala-salat
Right - you define unique indices on the Mongo collection itself, not
the model object.
On Jun 5, 10:32 am, Zoro <khandra...@gmail.com> wrote:
> Sorry, asked the wrong question. In fact, I was interested in how to make
> a field unique. I thought that there is the annotation like @Unique or
> something like this. Now I know that it is not.
>
> In any case, thanks for the great plugin