Is there anyway we can use sometihng simmiliar to join in mongodb with 
web2py. Because web2py gives us this model structure (similar to tables) 
where i'll have to use related fields but what's the point of using 
reference fields if i can't perform join. 

So suppose for a simple blog application with web2py and mongodb, do i have 
to make one model only for storing comments and likes and the body of the 
post itself ?? or i can have separate models for them and use relation 
somehow. 
Please answer and help me with this, becuase i have tried everywhere and 
not finding the right solution.  

On Monday, November 11, 2013 at 8:39:44 AM UTC+5:30, Massimo Di Pierro 
wrote:
>
> This is a join
>
>     table=db((db.mytable.id==db.another_table.mytable)).select()
>
> Mongodb does not provide joins (nor transactions) that is why it can do 
> sharding. That is the all point of nosql.
>
>
> On Sunday, 10 November 2013 17:39:07 UTC-6, Tito Garrido wrote:
>>
>> Hi Folks,
>>
>> I am trying to execute a simple test in mongodb (it worked on SQLite):
>> Model:
>> db.define_table('mytable',
>>     Field('name','string'),
>>     Field('age', 'integer'),
>>     Field('description', 'text'))
>>
>> db.define_table('another_table',
>>     Field('mytable', 'reference mytable'),
>>     Field('name', 'string'),
>>     Field('description', 'text'))
>>
>> Controller:
>> def index():
>>     table=db((db.mytable.id==db.another_table.mytable)).select()
>>     return dict(table=table)
>>
>> Ticket ID 
>>
>> 177.205.253.190.2013-11-10.18-36-12.7a03dad2-ba10-45f0-93b1-958b0f02c843
>> <type 'exceptions.RuntimeError'> Too many tables selected Versão 
>> web2py™ Version 2.7.4-stable+timestamp.2013.10.14.15.16.29 
>> Python Python 2.7.3: /usr/local/bin/uwsgi (prefix: /usr) Traceback 
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>> 15.
>> 16.
>> 17.
>> 18.
>>
>> Traceback (most recent call last):
>>   File "/home/www-data/web2py/gluon/restricted.py", line 217, in restricted
>>
>>
>>     exec ccode in environment
>>   File "/home/www-data/web2py/applications/bootstrap/controllers/default.py" 
>> <https://162.243.7.55/admin/default/edit/bootstrap/controllers/default.py>, 
>> line 78, in <module>
>>
>>
>>   File "/home/www-data/web2py/gluon/globals.py", line 372, in <lambda>
>>
>>
>>     self._caller = lambda f: f()
>>
>>
>>   File "/home/www-data/web2py/applications/bootstrap/controllers/default.py" 
>> <https://162.243.7.55/admin/default/edit/bootstrap/controllers/default.py>, 
>> line 21, in index
>>
>>
>>     table=db((db.mytable.id==db.another_table.mytable)).select()
>>
>>
>>   File "/home/www-data/web2py/gluon/dal.py", line 10111, in select
>>
>>
>>     return adapter.select(self.query,fields,attributes)
>>
>>
>>   File "/home/www-data/web2py/gluon/dal.py", line 5552, in select
>>
>>
>>     limitby_limit, limitby_skip = self._select(query, fields, attributes)
>>
>>
>>   File "/home/www-data/web2py/gluon/dal.py", line 5534, in _select
>>
>>
>>     tablename = self.get_table(query)
>>
>>
>>   File "/home/www-data/web2py/gluon/dal.py", line 1544, in get_table
>>
>>
>>     raise RuntimeError("Too many tables selected")
>>
>> RuntimeError: Too many tables selected
>>
>>
>>
>> This is what I got... Is there any inner join limit on mongodb?
>>
>> Thanks!
>>
>> Tito
>>
>> -- 
>>
>> Linux User #387870
>> .........____
>> .... _/_õ|__|
>> ..º[ .-.___.-._| . . . .
>> .__( o)__( o).:_______ 
>>
>

-- 
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.

Reply via email to