Glad that my thoughts help you (and maybe others too).

Regards,

2015-05-30 11:14 GMT-03:00 Ron Chatterjee <achatterjee...@gmail.com>:

> Its an interesting topic. I am yet to figure out how mongodb handles many
> to many relationship. For example, the facebook app that Massimo posted. It
> utilizes many-to-many relationship using a junction table call "link" to
> tie the "target" and "source" field to auth_user. Every where I read, they
> say mongo is better to design such scenario. Will be interesting to know.
> Thanks for this post Jose.
>
> On Friday, May 29, 2015 at 9:51:14 PM UTC-4, José Borba wrote:
>>
>> Closing with success....
>>
>> If more people need to import data from CSV files and need to reference
>> other collections in MongoDB, just prepare the file in the way described
>> below (recipe).
>>
>> In a separate file (py) do this
>> - search your term in MongoDB collection of your choice;
>> - convert the _id in int from hex [ like  int('deadbeef',16) ];
>> - convert the int in str;
>> - save your csv with this string (shoul be the Looooooong integer above);
>> - import the file!
>>
>> This is the code I've used to do this.
>> https://gist.github.com/jrborbars/63a82486bdddfc13e365
>>
>> Best regards,
>>
>>
>> 2015-05-29 22:12 GMT-03:00 José Ricardo Borba <jrbor...@gmail.com>:
>>
>>> Hummmmm.......
>>>
>>> Seems that web2py converts the hex _id of ObjectId to the Loooooooooong
>>> integer that represent that number.
>>>
>>> So, this is not an issue. I need to think again.......
>>>
>>> Best regards,
>>>
>>> 2015-05-29 18:22 GMT-03:00 José Ricardo Borba <jrbor...@gmail.com>:
>>>
>>>> Hello all,
>>>>
>>>> I'm experiencing some issues with web2py and MongoDB 3.0.3 _id field.
>>>>
>>>> With web2py 2.10.4 the _id field (ObjectId) is showed in this way:
>>>>
>>>> 26418130264307745716389872944
>>>> 26418130264307745716389872963
>>>> .
>>>> .
>>>>
>>>>
>>>> With Ipython 3.1.0 (with [python2.7.9 or 3.4.3 and pymongo] OR mongodb
>>>> shell 3.0.3) the _id field (ObjectId) is showed in this way:
>>>>
>>>> 555c90af47439f0958f10530
>>>> 555c90af47439f0958f10543
>>>> .
>>>> .
>>>>
>>>> I think that the last is the correct way to show the _id, because both
>>>> pymongo and mongoshell showed the same. But why the web2py is not showing
>>>> the correct _id? Maybe I'm doing something wrong?
>>>>
>>>> The last record was imported from a CSV file, and the first was
>>>> inserted from web2py form (from SQLGRID).
>>>>
>>>> Best regards,
>>>>
>>>> --
>>>> José Ricardo Borba
>>>>
>>>>
>>>
>>>
>>> --
>>> José Ricardo Borba
>>>
>>>
>>
>>
>> --
>> José Ricardo Borba
>>
>>   --
> 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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
José Ricardo Borba

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

Reply via email to