I am looking at this link:
http://blog.mongodb.org/post/27907941873/using-the-python-toolkit-ming-to-accelerate-your
I am looking at the imperative style and its so similar to DAL. Do we have
an interface between ming and DAL. That will bridge the gap I am sure.
# "Imperative" styleBlogPost = collection(
'blog.posts', session,
Field('_id', S.ObjectId),
Field('posted', datetime, if_missing=datetime.utcnow),
Field('title', str),
Field('author', User),
Field('text', str),
Field('comments', [
dict(author=User,
posted=S.DateTime(if_missing=datetime.utcnow),
text=str) ]))
On Monday, May 18, 2015 at 5:53:41 PM UTC-4, Ron Chatterjee wrote:
>
> Is there a way to use mongo engine field type (ODM) directly inside
> web2py. I know in django (ORM) I can use a document class instead of the
> model. For example:
>
>
> #-------------------------------------------------------------------------------------------------------------------------------------------
>
> from mongoengine import Document, StringField, DateTimeField
> import datetime
>
>
> class Post(Document):
> title = StringField(max_length=200, required=True)
> content = StringField(required=True)
> date_published = DateTimeField(default=datetime.datetime.now,
> required=True)
>
>
> #------------------------------------------------------------------------------------------------------------------------------------------
>
>
> MongoEngine field type Django ORM equivalent Web2py DAL equivalent
> StringField CharField string URLField URLField IS_URL EmailField
> EmailField IS_EMAIL IntField IntegerField integer FloatField FloatField
> N/A DecimalField DecimalField N/A BooleanField BooleanField Boolean
> DateTimeField DateTimeField datetime EmbeddedDocumentField None
> DictField None ListField None list:string SortedListField None
> BinaryField None N/A ObjectIdField None FileField FileField upload
>
>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.