Skip to content

Hy and MongoEngine #2316

Answered by Kodiologist
RickBradford asked this question in Q&A
Jul 10, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

It should always be possible to do a straight translation of any Python code into Hy. In this case, it's:

(defclass User [Document]
  (setv email (StringField :required True))
  (setv first_name (StringField :max_length 50))
  (setv last_name (StringField :max_length 50)))

(setv ross (User :email "[email protected]" :first_name "Ross" :last_name "Lawley"))

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@RickBradford
Comment options

Answer selected by RickBradford
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants