how to duplicate document with Voyage

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

how to duplicate document with Voyage

Olivier Auverlot
Hi,

I'm using Voyage and I need to duplicate an existing document in a Mongo
database. I suppose that the id must be changed before saving.

What is the best way to do that ?

Best regards
Olivier ;-)



Reply | Threaded
Open this post in threaded view
|

Re: how to duplicate document with Voyage

NorbertHartl

Am 17.04.2014 um 10:08 schrieb Olivier Auverlot <[hidden email]>:

> Hi,
>
> I'm using Voyage and I need to duplicate an existing document in a Mongo database. I suppose that the id must be changed before saving.
>
> What is the best way to do that ?
>
If you need a shallow copy then you better just copy the object and store it. Changing the id is asking for trouble I guess. That would probably work if you implement #= on those objects but I think it is a hack.

anObject copy save

should do.

Norbert


Reply | Threaded
Open this post in threaded view
|

Re: how to duplicate document with Voyage

EstebanLM

On 17 Apr 2014, at 10:17, Norbert Hartl <[hidden email]> wrote:

>
> Am 17.04.2014 um 10:08 schrieb Olivier Auverlot <[hidden email]>:
>
>> Hi,
>>
>> I'm using Voyage and I need to duplicate an existing document in a Mongo database. I suppose that the id must be changed before saving.
>>
>> What is the best way to do that ?
>>
> If you need a shallow copy then you better just copy the object and store it. Changing the id is asking for trouble I guess. That would probably work if you implement #= on those objects but I think it is a hack.
>
> anObject copy save

+1

>
> should do.
>
> Norbert
>
>


Reply | Threaded
Open this post in threaded view
|

Re: how to duplicate document with Voyage

Olivier Auverlot
simply ? Thanks ;-)


2014-04-17 10:42 GMT+02:00 Esteban Lorenzano <[hidden email]>:

On 17 Apr 2014, at 10:17, Norbert Hartl <[hidden email]> wrote:

>
> Am 17.04.2014 um 10:08 schrieb Olivier Auverlot <[hidden email]>:
>
>> Hi,
>>
>> I'm using Voyage and I need to duplicate an existing document in a Mongo database. I suppose that the id must be changed before saving.
>>
>> What is the best way to do that ?
>>
> If you need a shallow copy then you better just copy the object and store it. Changing the id is asking for trouble I guess. That would probably work if you implement #= on those objects but I think it is a hack.
>
> anObject copy save

+1

>
> should do.
>
> Norbert
>
>



Reply | Threaded
Open this post in threaded view
|

Re: how to duplicate document with Voyage

pharo4Stef@free.fr
In reply to this post by NorbertHartl
Hi norbert

Olivier was doing a copy but it did not work and we thought that
Voyage should offer a clone or something like that that does not mess up
with the id.
Because we already corrupted nicely a mongoDB.

Stef

On 17/4/14 10:17, Norbert Hartl wrote:

> Am 17.04.2014 um 10:08 schrieb Olivier Auverlot <[hidden email]>:
>
>> Hi,
>>
>> I'm using Voyage and I need to duplicate an existing document in a Mongo database. I suppose that the id must be changed before saving.
>>
>> What is the best way to do that ?
>>
> If you need a shallow copy then you better just copy the object and store it. Changing the id is asking for trouble I guess. That would probably work if you implement #= on those objects but I think it is a hack.
>
> anObject copy save
>
> should do.
>
> Norbert
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: how to duplicate document with Voyage

pharo4Stef@free.fr
In reply to this post by Olivier Auverlot
Ok so what I said was wrong :)

On 17/4/14 10:48, olivier auverlot wrote:
simply ? Thanks ;-)


2014-04-17 10:42 GMT+02:00 Esteban Lorenzano <[hidden email]>:

On 17 Apr 2014, at 10:17, Norbert Hartl <[hidden email]> wrote:

>
> Am 17.04.2014 um 10:08 schrieb Olivier Auverlot <[hidden email]>:
>
>> Hi,
>>
>> I'm using Voyage and I need to duplicate an existing document in a Mongo database. I suppose that the id must be changed before saving.
>>
>> What is the best way to do that ?
>>
> If you need a shallow copy then you better just copy the object and store it. Changing the id is asking for trouble I guess. That would probably work if you implement #= on those objects but I think it is a hack.
>
> anObject copy save

+1

>
> should do.
>
> Norbert
>
>




Reply | Threaded
Open this post in threaded view
|

Re: how to duplicate document with Voyage

EstebanLM
In reply to this post by pharo4Stef@free.fr
Hi,

copy should not mess with the id (unless your objects redefines = and hash).
I can take a look if Olivier is around tomorrow.

Esteban

On 17 Apr 2014, at 21:41, [hidden email] wrote:

> Hi norbert
>
> Olivier was doing a copy but it did not work and we thought that
> Voyage should offer a clone or something like that that does not mess up with the id.
> Because we already corrupted nicely a mongoDB.
>
> Stef
>
> On 17/4/14 10:17, Norbert Hartl wrote:
>> Am 17.04.2014 um 10:08 schrieb Olivier Auverlot <[hidden email]>:
>>
>>> Hi,
>>>
>>> I'm using Voyage and I need to duplicate an existing document in a Mongo database. I suppose that the id must be changed before saving.
>>>
>>> What is the best way to do that ?
>>>
>> If you need a shallow copy then you better just copy the object and store it. Changing the id is asking for trouble I guess. That would probably work if you implement #= on those objects but I think it is a hack.
>>
>> anObject copy save
>>
>> should do.
>>
>> Norbert
>>
>>
>>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: how to duplicate document with Voyage

pharo4Stef@free.fr

On 17/4/14 21:45, Esteban Lorenzano wrote:
> Hi,
>
> copy should not mess with the id (unless your objects redefines = and hash).
> I can take a look if Olivier is around tomorrow.

Thanks. I told him to talk to you but this is a really shy guy :)
He is pushing Pharo to build other application in the lab :)

>
> Esteban
>
> On 17 Apr 2014, at 21:41, [hidden email] wrote:
>
>> Hi norbert
>>
>> Olivier was doing a copy but it did not work and we thought that
>> Voyage should offer a clone or something like that that does not mess up with the id.
>> Because we already corrupted nicely a mongoDB.
>>
>> Stef
>>
>> On 17/4/14 10:17, Norbert Hartl wrote:
>>> Am 17.04.2014 um 10:08 schrieb Olivier Auverlot <[hidden email]>:
>>>
>>>> Hi,
>>>>
>>>> I'm using Voyage and I need to duplicate an existing document in a Mongo database. I suppose that the id must be changed before saving.
>>>>
>>>> What is the best way to do that ?
>>>>
>>> If you need a shallow copy then you better just copy the object and store it. Changing the id is asking for trouble I guess. That would probably work if you implement #= on those objects but I think it is a hack.
>>>
>>> anObject copy save
>>>
>>> should do.
>>>
>>> Norbert
>>>
>>>
>>>
>>
>
>
>