[Voyage] Accessing ObjectID(_id) when retrieving objects.
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
Am 01.02.2017 um 15:25 schrieb sergio ruiz <sergio.rrd@gmail.com>:
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
Thanks!
---- peace, sergio photographer, journalist, visionary
Public Key: http://bit.ly/29z9fG0 <http://bit.ly/29z9fG0> #BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV http://www.Village-Buzz.com <http://www.village-buzz.com/> http://www.ThoseOptimizeGuys.com <http://www.thoseoptimizeguys.com/> http://www.coffee-black.com <http://www.coffee-black.com/> http://www.painlessfrugality.com <http://www.painlessfrugality.com/> http://www.twitter.com/sergio_101 <http://www.twitter.com/sergio_101> http://www.facebook.com/sergio101 <http://www.facebook.com/sergio101>
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 (norbert@hartl.name) 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
hmmm.. can you query for an object with that voyageId? On February 1, 2017 at 9:37:43 AM, Norbert Hartl (norbert@hartl.name) 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
Am 01.02.2017 um 16:11 schrieb sergio ruiz <sergio.rrd@gmail.com>:
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 (norbert@hartl.name <mailto:norbert@hartl.name>) 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 <http://bit.ly/29z9fG0> #BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV http://www.Village-Buzz.com <http://www.village-buzz.com/> http://www.ThoseOptimizeGuys.com <http://www.thoseoptimizeguys.com/> http://www.coffee-black.com <http://www.coffee-black.com/> http://www.painlessfrugality.com <http://www.painlessfrugality.com/> http://www.twitter.com/sergio_101 <http://www.twitter.com/sergio_101> http://www.facebook.com/sergio101 <http://www.facebook.com/sergio101>
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 (norbert@hartl.name) 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
Am 01.02.2017 um 17:02 schrieb sergio ruiz <sergio.rrd@gmail.com>:
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 (norbert@hartl.name <mailto:norbert@hartl.name>) wrote:
MyClass selectOne: { '_id' -> (OID value: 16r<hex value>) } asDictionary
---- peace, sergio photographer, journalist, visionary
Public Key: http://bit.ly/29z9fG0 <http://bit.ly/29z9fG0> #BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2dV http://www.Village-Buzz.com <http://www.village-buzz.com/> http://www.ThoseOptimizeGuys.com <http://www.thoseoptimizeguys.com/> http://www.coffee-black.com <http://www.coffee-black.com/> http://www.painlessfrugality.com <http://www.painlessfrugality.com/> http://www.twitter.com/sergio_101 <http://www.twitter.com/sergio_101> http://www.facebook.com/sergio101 <http://www.facebook.com/sergio101>
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 (norbert@hartl.name) 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
participants (2)
-
Norbert Hartl -
sergio ruiz