[Voyage] Accessing ObjectID(_id) when retrieving objects.

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

[Voyage] Accessing ObjectID(_id) when retrieving objects.

sergio_101
Hi, all..

I am working on a Teapot REST interface, and am getting ready to implement the create, read, and update methods for the objects, and I need a way to refer to the objects. I figured that since Voyage was already creating _id through MongoDB, I could just pass that on when I retrieved that object, but I don’t see how to do that.

Is this possible? Would I need to create my own numerical indexes to my objects and just retrieve them as part of the object query?


Thanks!

----
peace,
sergio
photographer, journalist, visionary

Public Key: http://bit.ly/29z9fG0
#BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
http://www.Village-Buzz.com
http://www.ThoseOptimizeGuys.com
http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101

signature.asc (852 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Voyage] Accessing ObjectID(_id) when retrieving objects.

NorbertHartl

Am 01.02.2017 um 15:25 schrieb sergio ruiz <[hidden email]>:

Hi, all..

I am working on a Teapot REST interface, and am getting ready to implement the create, read, and update methods for the objects, and I need a way to refer to the objects. I figured that since Voyage was already creating _id through MongoDB, I could just pass that on when I retrieved that object, but I don’t see how to do that.

Is this possible? Would I need to create my own numerical indexes to my objects and just retrieve them as part of the object query?


You can ask every voyage object for its id. Just do 

anObject voyageId

you get an OID object which you can ask for its #value to get the numeric id.

Norbert

Reply | Threaded
Open this post in threaded view
|

Re: [Voyage] Accessing ObjectID(_id) when retrieving objects.

sergio_101
Perfect! this is what i needed.. i don’t want to manage two sets of IDs..

Thanks!

On February 1, 2017 at 9:37:43 AM, Norbert Hartl ([hidden email]) wrote:

You can ask every voyage object for its id. Just do 

anObject voyageId

you get an OID object which you can ask for its #value to get the numeric id.

----
peace,
sergio
photographer, journalist, visionary

Public Key: http://bit.ly/29z9fG0
#BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
http://www.Village-Buzz.com
http://www.ThoseOptimizeGuys.com
http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101

signature.asc (852 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Voyage] Accessing ObjectID(_id) when retrieving objects.

sergio_101
In reply to this post by NorbertHartl
hmmm.. can you query for an object with that voyageId?

On February 1, 2017 at 9:37:43 AM, Norbert Hartl ([hidden email]) wrote:

You can ask every voyage object for its id. Just do 

anObject voyageId

you get an OID object which you can ask for its #value to get the numeric id.

Norbert
----
peace,
sergio
photographer, journalist, visionary

Public Key: http://bit.ly/29z9fG0
#BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
http://www.Village-Buzz.com
http://www.ThoseOptimizeGuys.com
http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101

signature.asc (852 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Voyage] Accessing ObjectID(_id) when retrieving objects.

NorbertHartl

Am 01.02.2017 um 16:11 schrieb sergio ruiz <[hidden email]>:

hmmm.. can you query for an object with that voyageId?

Sure. I don't know if there is a more clever way to do but this will work in any case

MyClass selectOne: {
'_id' -> (OID value: 16r<hex value>) } asDictionary

Norbert


On February 1, 2017 at 9:37:43 AM, Norbert Hartl ([hidden email]) wrote:

You can ask every voyage object for its id. Just do 

anObject voyageId

you get an OID object which you can ask for its #value to get the numeric id.

Norbert

Reply | Threaded
Open this post in threaded view
|

Re: [Voyage] Accessing ObjectID(_id) when retrieving objects.

sergio_101
Got it..

Smalltalk is one language where it ALWAYS seems that there is a more clever way to do anything than the way i am doing it..

I’ll try this..

Thanks!

On February 1, 2017 at 10:43:36 AM, Norbert Hartl ([hidden email]) wrote:


MyClass selectOne: {
'_id' -> (OID value: 16r<hex value>) } asDictionary

----
peace,
sergio
photographer, journalist, visionary

Public Key: http://bit.ly/29z9fG0
#BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
http://www.Village-Buzz.com
http://www.ThoseOptimizeGuys.com
http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101

signature.asc (852 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Voyage] Accessing ObjectID(_id) when retrieving objects.

NorbertHartl

Am 01.02.2017 um 17:02 schrieb sergio ruiz <[hidden email]>:

Got it..

Smalltalk is one language where it ALWAYS seems that there is a more clever way to do anything than the way i am doing it..

I’ll try this..


Don't worry. That is the experience we all had (and have). You look for a method (most probably it exists alreay) but you cannot find because you are not thinking the straight way ;)

Norbert

Thanks!

On February 1, 2017 at 10:43:36 AM, Norbert Hartl ([hidden email]) wrote:


MyClass selectOne: {
'_id' -> (OID value: 16r<hex value>) } asDictionary


Reply | Threaded
Open this post in threaded view
|

Re: [Voyage] Accessing ObjectID(_id) when retrieving objects.

sergio_101
Yes.. smalltalk doesn’t impose a whole lot of style limitations on the developer, and most of the code i run into is very high quality.. so, using all the available code, you’re really just learning good practices from a bunch of smart people…

the language is really inconsequential..

On February 1, 2017 at 11:29:12 AM, Norbert Hartl ([hidden email]) wrote:

Don't worry. That is the experience we all had (and have). You look for a method (most probably it exists alreay) but you cannot find because you are not thinking the straight way ;)

Norbert
----
peace,
sergio
photographer, journalist, visionary

Public Key: http://bit.ly/29z9fG0
#BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV
http://www.Village-Buzz.com
http://www.ThoseOptimizeGuys.com
http://www.coffee-black.com
http://www.painlessfrugality.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101

signature.asc (852 bytes) Download Attachment