The support of MongoDB is still experimental?

48 views
Skip to first unread message

João Matos

unread,
Apr 9, 2019, 6:37:04 PM4/9/19
to web2py-users
Hello,

The support of MongoDB is still experimental?

Thanks,

JM

Anthony

unread,
Apr 9, 2019, 6:59:36 PM4/9/19
to web2py-users
I don't think so -- just that the book was never updated.

João Matos

unread,
Apr 9, 2019, 7:09:35 PM4/9/19
to web2py-users
Thanks Anthony. Who can confirm this? Is ti Massimo or is there another person in charge of MongoDB in web2py?

Lovedie JC

unread,
Apr 9, 2019, 11:33:32 PM4/9/19
to web...@googlegroups.com
I use mongodb. It works well. I think digital Ocean.com implements it nicely

--
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 web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

João Matos

unread,
Apr 10, 2019, 10:01:44 AM4/10/19
to web2py-users
Thanks for the feedback.

Do you use it through the DAL or directly?
If you use it through the DAL, are you able to select, insert, delete and update records without any issue?
Do you recommend it?
To unsubscribe from this group and stop receiving emails from it, send an email to web...@googlegroups.com.

Lovedie JC

unread,
Apr 10, 2019, 10:33:46 AM4/10/19
to web...@googlegroups.com
I send you an example. Yes I use through DAL. It's nice. 

To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.

João Matos

unread,
Apr 10, 2019, 12:38:43 PM4/10/19
to web2py-users
Thanks, an example would be great.

Lovedie JC

unread,
Apr 10, 2019, 1:57:11 PM4/10/19
to web...@googlegroups.com
ON the localhost

# coding: utf8
from gluon import current
from pymongo import MongoClient
from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
from gluon.custom_import import track_changes
track_changes(True)
db = DAL('mongodb://localhost/"db name"')
response.generic_patterns = ['*'] if request.is_local else []
auth = Auth(db, hmac_key=Auth.get_or_create_key())

db.define_table('post',
                Field('author', 'reference auth_user', default=auth.user_id, readable=False, writable=False),
                Field('message', 'text', requires=IS_NOT_EMPTY(),),
                auth.signature
                )

controller:
row = db(db.post.author== auth.user.id).select(db.post.id, db.post.message, orderby=~db.post.id, limitby=(0,1)).first()

MongoDB
# I use ubuntu 18.04LTS
1. Download the mongo db browser, studio 3T from  https://studio3t.com/download/ 
2. Follow instructions after download
3. It will save in the homepage as folder(called robo3t)
4. In the folder, bin folder, find the robo3t app. Click on it, then click on connect to see your db. See the images attached.

N/B I noted that sometimes the error of 'Null type' comes when accessing the db when no value has been entered/posted. SO post some value and see it in the database with the browser.




To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
Screenshot from 2019-04-10 20-40-42.png
Screenshot from 2019-04-10 20-39-56.png
Screenshot from 2019-04-10 20-39-17.png

João Matos

unread,
Apr 10, 2019, 2:09:01 PM4/10/19
to web2py-users
Thanks.
Reply all
Reply to author
Forward
0 new messages