Reputation: 3362
I'm building a web application in yesod with mongodb.
I'm tryign to create a model called Message:
Message _id Text threadKey Text body Text
But I can't seem to access the _id field this way, the message_id function doesn't get created, unlike messageThreadKey and messageBody.
How can I access the _id field of mongo objects from yesod/persistent-mongoDB?
Upvotes: 0
Views: 226
Reputation: 1166
In persistent the id (in both the SQL version and the Mongo version) is special and not actually part of the model record. The combination of a Id and a Model Record is called an Entity.
I would reread the persistent chapter of the Yesod book under the Manipulation section, Insert subsection.
http://www.yesodweb.com/book/persistent
Upvotes: 1