Hi, i create one class with morphia.. and put one ObejctID, but i wanna know if i have another ID , something like SGDB id, sequential id, because i need to pass the id to view and than back to front. so i can olny pass the id
You can use any id generation system you want. By default an ObjectID
is suggested since it doesn't require any interaction with the server
to generate and is unique.
You can simply pass the (hex) string version of the ObjectId as the id
to your html/web-app; that works just fine.
On Sat, May 19, 2012 at 11:25 AM, FabioEbner <fabioeb...@gmail.com> wrote:
> Hi, i create one class with morphia.. and put one ObejctID, but i wanna know
> if i have another ID , something like SGDB id, sequential id, because i need
> to pass the id to view and than back to front. so i can olny pass the id
> tks
> --
> You received this message because you are subscribed to the Google
> Groups "mongodb-user" group.
> To post to this group, send email to mongodb-user@googlegroups.com
> To unsubscribe from this group, send email to
> mongodb-user+unsubscribe@googlegroups.com
> See also the IRC channel -- freenode.net#mongodb
> You can use any id generation system you want. By default an ObjectID
> is suggested since it doesn't require any interaction with the server
> to generate and is unique.
> You can simply pass the (hex) string version of the ObjectId as the id
> to your html/web-app; that works just fine.
> If you want to maintain a sequence/counter there are example in the
> docs and an example annotation in morphia you can use. It is not
> suggested as it requires going to the server before every insert to
> get an id.
> http://www.mongodb.org/display/DOCS/How+to+Make+an+Auto+Incrementing+...
> On Sat, May 19, 2012 at 11:25 AM, FabioEbner <fabioeb...@gmail.com> wrote:
> > Hi, i create one class with morphia.. and put one ObejctID, but i wanna
> know
> > if i have another ID , something like SGDB id, sequential id, because i
> need
> > to pass the id to view and than back to front. so i can olny pass the id
> > tks
> > --
> > You received this message because you are subscribed to the Google
> > Groups "mongodb-user" group.
> > To post to this group, send email to mongodb-user@googlegroups.com
> > To unsubscribe from this group, send email to
> > mongodb-user+unsubscribe@googlegroups.com
> > See also the IRC channel -- freenode.net#mongodb
> --
> You received this message because you are subscribed to the Google
> Groups "mongodb-user" group.
> To post to this group, send email to mongodb-user@googlegroups.com
> To unsubscribe from this group, send email to
> mongodb-user+unsubscribe@googlegroups.com
> See also the IRC channel -- freenode.net#mongodb
On Sat, May 19, 2012 at 2:27 PM, Fabio Ebner <fabioeb...@gmail.com> wrote:
> can you send one example? i use ObjectID to create automatic the id.
> 2012/5/19 Scott Hernandez <scotthernan...@gmail.com>
>> You can use any id generation system you want. By default an ObjectID
>> is suggested since it doesn't require any interaction with the server
>> to generate and is unique.
>> You can simply pass the (hex) string version of the ObjectId as the id
>> to your html/web-app; that works just fine.
>> If you want to maintain a sequence/counter there are example in the
>> docs and an example annotation in morphia you can use. It is not
>> suggested as it requires going to the server before every insert to
>> get an id.
>> http://www.mongodb.org/display/DOCS/How+to+Make+an+Auto+Incrementing+...
>> On Sat, May 19, 2012 at 11:25 AM, FabioEbner <fabioeb...@gmail.com> wrote:
>> > Hi, i create one class with morphia.. and put one ObejctID, but i wanna
>> > know
>> > if i have another ID , something like SGDB id, sequential id, because i
>> > need
>> > to pass the id to view and than back to front. so i can olny pass the id
>> > tks
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "mongodb-user" group.
>> > To post to this group, send email to mongodb-user@googlegroups.com
>> > To unsubscribe from this group, send email to
>> > mongodb-user+unsubscribe@googlegroups.com
>> > See also the IRC channel -- freenode.net#mongodb
>> --
>> You received this message because you are subscribed to the Google
>> Groups "mongodb-user" group.
>> To post to this group, send email to mongodb-user@googlegroups.com
>> To unsubscribe from this group, send email to
>> mongodb-user+unsubscribe@googlegroups.com
>> See also the IRC channel -- freenode.net#mongodb
> --
> You received this message because you are subscribed to the Google
> Groups "mongodb-user" group.
> To post to this group, send email to mongodb-user@googlegroups.com
> To unsubscribe from this group, send email to
> mongodb-user+unsubscribe@googlegroups.com
> See also the IRC channel -- freenode.net#mongodb
> On Sat, May 19, 2012 at 2:27 PM, Fabio Ebner <fabioeb...@gmail.com> wrote:
> > can you send one example? i use ObjectID to create automatic the id.
> > 2012/5/19 Scott Hernandez <scotthernan...@gmail.com>
> >> You can use any id generation system you want. By default an ObjectID
> >> is suggested since it doesn't require any interaction with the server
> >> to generate and is unique.
> >> You can simply pass the (hex) string version of the ObjectId as the id
> >> to your html/web-app; that works just fine.
> >> If you want to maintain a sequence/counter there are example in the
> >> docs and an example annotation in morphia you can use. It is not
> >> suggested as it requires going to the server before every insert to
> >> get an id.
> >> On Sat, May 19, 2012 at 11:25 AM, FabioEbner <fabioeb...@gmail.com>
> wrote:
> >> > Hi, i create one class with morphia.. and put one ObejctID, but i
> wanna
> >> > know
> >> > if i have another ID , something like SGDB id, sequential id, because
> i
> >> > need
> >> > to pass the id to view and than back to front. so i can olny pass the
> id
> >> > tks
> >> > --
> >> > You received this message because you are subscribed to the Google
> >> > Groups "mongodb-user" group.
> >> > To post to this group, send email to mongodb-user@googlegroups.com
> >> > To unsubscribe from this group, send email to
> >> > mongodb-user+unsubscribe@googlegroups.com
> >> > See also the IRC channel -- freenode.net#mongodb
> >> --
> >> You received this message because you are subscribed to the Google
> >> Groups "mongodb-user" group.
> >> To post to this group, send email to mongodb-user@googlegroups.com
> >> To unsubscribe from this group, send email to
> >> mongodb-user+unsubscribe@googlegroups.com
> >> See also the IRC channel -- freenode.net#mongodb
> > --
> > You received this message because you are subscribed to the Google
> > Groups "mongodb-user" group.
> > To post to this group, send email to mongodb-user@googlegroups.com
> > To unsubscribe from this group, send email to
> > mongodb-user+unsubscribe@googlegroups.com
> > See also the IRC channel -- freenode.net#mongodb
> --
> You received this message because you are subscribed to the Google
> Groups "mongodb-user" group.
> To post to this group, send email to mongodb-user@googlegroups.com
> To unsubscribe from this group, send email to
> mongodb-user+unsubscribe@googlegroups.com
> See also the IRC channel -- freenode.net#mongodb
> On Sat, May 19, 2012 at 2:27 PM, Fabio Ebner <fabioeb...@gmail.com> wrote:
> > can you send one example? i use ObjectID to create automatic the id.
> > 2012/5/19 Scott Hernandez <scotthernan...@gmail.com>
> >> You can use any id generation system you want. By default an ObjectID
> >> is suggested since it doesn't require any interaction with the server
> >> to generate and is unique.
> >> You can simply pass the (hex) string version of the ObjectId as the id
> >> to your html/web-app; that works just fine.
> >> If you want to maintain a sequence/counter there are example in the
> >> docs and an example annotation in morphia you can use. It is not
> >> suggested as it requires going to the server before every insert to
> >> get an id.
> >> On Sat, May 19, 2012 at 11:25 AM, FabioEbner <fabioeb...@gmail.com>
> wrote:
> >> > Hi, i create one class with morphia.. and put one ObejctID, but i
> wanna
> >> > know
> >> > if i have another ID , something like SGDB id, sequential id, because
> i
> >> > need
> >> > to pass the id to view and than back to front. so i can olny pass the
> id
> >> > tks
> >> > --
> >> > You received this message because you are subscribed to the Google
> >> > Groups "mongodb-user" group.
> >> > To post to this group, send email to mongodb-user@googlegroups.com
> >> > To unsubscribe from this group, send email to
> >> > mongodb-user+unsubscribe@googlegroups.com
> >> > See also the IRC channel -- freenode.net#mongodb
> >> --
> >> You received this message because you are subscribed to the Google
> >> Groups "mongodb-user" group.
> >> To post to this group, send email to mongodb-user@googlegroups.com
> >> To unsubscribe from this group, send email to
> >> mongodb-user+unsubscribe@googlegroups.com
> >> See also the IRC channel -- freenode.net#mongodb
> > --
> > You received this message because you are subscribed to the Google
> > Groups "mongodb-user" group.
> > To post to this group, send email to mongodb-user@googlegroups.com
> > To unsubscribe from this group, send email to
> > mongodb-user+unsubscribe@googlegroups.com
> > See also the IRC channel -- freenode.net#mongodb
> --
> You received this message because you are subscribed to the Google
> Groups "mongodb-user" group.
> To post to this group, send email to mongodb-user@googlegroups.com
> To unsubscribe from this group, send email to
> mongodb-user+unsubscribe@googlegroups.com
> See also the IRC channel -- freenode.net#mongodb
> SELECT * FROM tablemane WHERE (a=1 OR b=1) AND (a=2 OR b=2)
> examples of mongodb query
> in mongodb ???
> 2012/5/19 Scott Hernandez <scotthernan...@gmail.com>
>> An example of what?
>> On Sat, May 19, 2012 at 2:27 PM, Fabio Ebner <fabioeb...@gmail.com>
>> wrote:
>> > can you send one example? i use ObjectID to create automatic the id.
>> > 2012/5/19 Scott Hernandez <scotthernan...@gmail.com>
>> >> You can use any id generation system you want. By default an ObjectID
>> >> is suggested since it doesn't require any interaction with the server
>> >> to generate and is unique.
>> >> You can simply pass the (hex) string version of the ObjectId as the id
>> >> to your html/web-app; that works just fine.
>> >> If you want to maintain a sequence/counter there are example in the
>> >> docs and an example annotation in morphia you can use. It is not
>> >> suggested as it requires going to the server before every insert to
>> >> get an id.
>> >> On Sat, May 19, 2012 at 11:25 AM, FabioEbner <fabioeb...@gmail.com>
>> wrote:
>> >> > Hi, i create one class with morphia.. and put one ObejctID, but i
>> wanna
>> >> > know
>> >> > if i have another ID , something like SGDB id, sequential id,
>> because i
>> >> > need
>> >> > to pass the id to view and than back to front. so i can olny pass
>> the id
>> >> > tks
>> >> > --
>> >> > You received this message because you are subscribed to the Google
>> >> > Groups "mongodb-user" group.
>> >> > To post to this group, send email to mongodb-user@googlegroups.com
>> >> > To unsubscribe from this group, send email to
>> >> > mongodb-user+unsubscribe@googlegroups.com
>> >> > See also the IRC channel -- freenode.net#mongodb
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups "mongodb-user" group.
>> >> To post to this group, send email to mongodb-user@googlegroups.com
>> >> To unsubscribe from this group, send email to
>> >> mongodb-user+unsubscribe@googlegroups.com
>> >> See also the IRC channel -- freenode.net#mongodb
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "mongodb-user" group.
>> > To post to this group, send email to mongodb-user@googlegroups.com
>> > To unsubscribe from this group, send email to
>> > mongodb-user+unsubscribe@googlegroups.com
>> > See also the IRC channel -- freenode.net#mongodb
>> --
>> You received this message because you are subscribed to the Google
>> Groups "mongodb-user" group.
>> To post to this group, send email to mongodb-user@googlegroups.com
>> To unsubscribe from this group, send email to
>> mongodb-user+unsubscribe@googlegroups.com
>> See also the IRC channel -- freenode.net#mongodb
> --
> You received this message because you are subscribed to the Google
> Groups "mongodb-user" group.
> To post to this group, send email to mongodb-user@googlegroups.com
> To unsubscribe from this group, send email to
> mongodb-user+unsubscribe@googlegroups.com
> See also the IRC channel -- freenode.net#mongodb
On Sat, May 19, 2012 at 4:41 PM, Fabio Ebner <fabioeb...@gmail.com> wrote:
> no..how i use java + morphia to get one data with id.. because i use java +
> morphi
> and my entity i create just like this.
> @id
> private ObjectId cdProduct;
> 2012/5/19 Giovanni Fabio <assisten...@gmail.com>
>> SELECT * FROM tablemane WHERE (a=1 OR b=1) AND (a=2 OR b=2)
>> examples of mongodb query
>> in mongodb ???
>> 2012/5/19 Scott Hernandez <scotthernan...@gmail.com>
>>> An example of what?
>>> On Sat, May 19, 2012 at 2:27 PM, Fabio Ebner <fabioeb...@gmail.com>
>>> wrote:
>>> > can you send one example? i use ObjectID to create automatic the id.
>>> > 2012/5/19 Scott Hernandez <scotthernan...@gmail.com>
>>> >> You can use any id generation system you want. By default an ObjectID
>>> >> is suggested since it doesn't require any interaction with the server
>>> >> to generate and is unique.
>>> >> You can simply pass the (hex) string version of the ObjectId as the id
>>> >> to your html/web-app; that works just fine.
>>> >> If you want to maintain a sequence/counter there are example in the
>>> >> docs and an example annotation in morphia you can use. It is not
>>> >> suggested as it requires going to the server before every insert to
>>> >> get an id.
>>> >> On Sat, May 19, 2012 at 11:25 AM, FabioEbner <fabioeb...@gmail.com>
>>> >> wrote:
>>> >> > Hi, i create one class with morphia.. and put one ObejctID, but i
>>> >> > wanna
>>> >> > know
>>> >> > if i have another ID , something like SGDB id, sequential id,
>>> >> > because i
>>> >> > need
>>> >> > to pass the id to view and than back to front. so i can olny pass
>>> >> > the id
>>> >> > tks
>>> >> > --
>>> >> > You received this message because you are subscribed to the Google
>>> >> > Groups "mongodb-user" group.
>>> >> > To post to this group, send email to mongodb-user@googlegroups.com
>>> >> > To unsubscribe from this group, send email to
>>> >> > mongodb-user+unsubscribe@googlegroups.com
>>> >> > See also the IRC channel -- freenode.net#mongodb
>>> >> --
>>> >> You received this message because you are subscribed to the Google
>>> >> Groups "mongodb-user" group.
>>> >> To post to this group, send email to mongodb-user@googlegroups.com
>>> >> To unsubscribe from this group, send email to
>>> >> mongodb-user+unsubscribe@googlegroups.com
>>> >> See also the IRC channel -- freenode.net#mongodb
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> > Groups "mongodb-user" group.
>>> > To post to this group, send email to mongodb-user@googlegroups.com
>>> > To unsubscribe from this group, send email to
>>> > mongodb-user+unsubscribe@googlegroups.com
>>> > See also the IRC channel -- freenode.net#mongodb
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "mongodb-user" group.
>>> To post to this group, send email to mongodb-user@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> mongodb-user+unsubscribe@googlegroups.com
>>> See also the IRC channel -- freenode.net#mongodb
>> --
>> You received this message because you are subscribed to the Google
>> Groups "mongodb-user" group.
>> To post to this group, send email to mongodb-user@googlegroups.com
>> To unsubscribe from this group, send email to
>> mongodb-user+unsubscribe@googlegroups.com
>> See also the IRC channel -- freenode.net#mongodb
> --
> You received this message because you are subscribed to the Google
> Groups "mongodb-user" group.
> To post to this group, send email to mongodb-user@googlegroups.com
> To unsubscribe from this group, send email to
> mongodb-user+unsubscribe@googlegroups.com
> See also the IRC channel -- freenode.net#mongodb
Yes, but my id is an ObjectID and this ObjectID have a few properties, so
in that way i need to pass the complete ObjectID?
i want something i just pass one number, not one object
did you undestand
2012/5/19 Scott Hernandez <scotthernan...@gmail.com>
> On Sat, May 19, 2012 at 4:41 PM, Fabio Ebner <fabioeb...@gmail.com> wrote:
> > no..how i use java + morphia to get one data with id.. because i use
> java +
> > morphi
> > and my entity i create just like this.
> > @id
> > private ObjectId cdProduct;
> > 2012/5/19 Giovanni Fabio <assisten...@gmail.com>
> >> SELECT * FROM tablemane WHERE (a=1 OR b=1) AND (a=2 OR b=2)
> >> examples of mongodb query
> >> in mongodb ???
> >> 2012/5/19 Scott Hernandez <scotthernan...@gmail.com>
> >>> An example of what?
> >>> On Sat, May 19, 2012 at 2:27 PM, Fabio Ebner <fabioeb...@gmail.com>
> >>> wrote:
> >>> > can you send one example? i use ObjectID to create automatic the id.
> >>> > 2012/5/19 Scott Hernandez <scotthernan...@gmail.com>
> >>> >> You can use any id generation system you want. By default an
> ObjectID
> >>> >> is suggested since it doesn't require any interaction with the
> server
> >>> >> to generate and is unique.
> >>> >> You can simply pass the (hex) string version of the ObjectId as the
> id
> >>> >> to your html/web-app; that works just fine.
> >>> >> If you want to maintain a sequence/counter there are example in the
> >>> >> docs and an example annotation in morphia you can use. It is not
> >>> >> suggested as it requires going to the server before every insert to
> >>> >> get an id.
> >>> >> On Sat, May 19, 2012 at 11:25 AM, FabioEbner <fabioeb...@gmail.com>
> >>> >> wrote:
> >>> >> > Hi, i create one class with morphia.. and put one ObejctID, but i
> >>> >> > wanna
> >>> >> > know
> >>> >> > if i have another ID , something like SGDB id, sequential id,
> >>> >> > because i
> >>> >> > need
> >>> >> > to pass the id to view and than back to front. so i can olny pass
> >>> >> > the id
> >>> >> > tks
> >>> >> > --
> >>> >> > You received this message because you are subscribed to the Google
> >>> >> > Groups "mongodb-user" group.
> >>> >> > To post to this group, send email to
> mongodb-user@googlegroups.com
> >>> >> > To unsubscribe from this group, send email to
> >>> >> > mongodb-user+unsubscribe@googlegroups.com
> >>> >> > See also the IRC channel -- freenode.net#mongodb
> >>> >> --
> >>> >> You received this message because you are subscribed to the Google
> >>> >> Groups "mongodb-user" group.
> >>> >> To post to this group, send email to mongodb-user@googlegroups.com
> >>> >> To unsubscribe from this group, send email to
> >>> >> mongodb-user+unsubscribe@googlegroups.com
> >>> >> See also the IRC channel -- freenode.net#mongodb
> >>> > --
> >>> > You received this message because you are subscribed to the Google
> >>> > Groups "mongodb-user" group.
> >>> > To post to this group, send email to mongodb-user@googlegroups.com
> >>> > To unsubscribe from this group, send email to
> >>> > mongodb-user+unsubscribe@googlegroups.com
> >>> > See also the IRC channel -- freenode.net#mongodb
> >>> --
> >>> You received this message because you are subscribed to the Google
> >>> Groups "mongodb-user" group.
> >>> To post to this group, send email to mongodb-user@googlegroups.com
> >>> To unsubscribe from this group, send email to
> >>> mongodb-user+unsubscribe@googlegroups.com
> >>> See also the IRC channel -- freenode.net#mongodb
> >> --
> >> You received this message because you are subscribed to the Google
> >> Groups "mongodb-user" group.
> >> To post to this group, send email to mongodb-user@googlegroups.com
> >> To unsubscribe from this group, send email to
> >> mongodb-user+unsubscribe@googlegroups.com
> >> See also the IRC channel -- freenode.net#mongodb
> > --
> > You received this message because you are subscribed to the Google
> > Groups "mongodb-user" group.
> > To post to this group, send email to mongodb-user@googlegroups.com
> > To unsubscribe from this group, send email to
> > mongodb-user+unsubscribe@googlegroups.com
> > See also the IRC channel -- freenode.net#mongodb
> --
> You received this message because you are subscribed to the Google
> Groups "mongodb-user" group.
> To post to this group, send email to mongodb-user@googlegroups.com
> To unsubscribe from this group, send email to
> mongodb-user+unsubscribe@googlegroups.com
> See also the IRC channel -- freenode.net#mongodb
On Sun, May 20, 2012 at 6:18 PM, Fabio Ebner <fabioeb...@gmail.com> wrote:
> Yes, but my id is an ObjectID and this ObjectID have a few properties, so in
> that way i need to pass the complete ObjectID?
> i want something i just pass one number, not one object
> did you undestand
> 2012/5/19 Scott Hernandez <scotthernan...@gmail.com>
>> On Sat, May 19, 2012 at 4:41 PM, Fabio Ebner <fabioeb...@gmail.com> wrote:
>> > no..how i use java + morphia to get one data with id.. because i use
>> > java +
>> > morphi
>> > and my entity i create just like this.
>> > @id
>> > private ObjectId cdProduct;
>> > 2012/5/19 Giovanni Fabio <assisten...@gmail.com>
>> >> SELECT * FROM tablemane WHERE (a=1 OR b=1) AND (a=2 OR b=2)
>> >> examples of mongodb query
>> >> in mongodb ???
>> >> 2012/5/19 Scott Hernandez <scotthernan...@gmail.com>
>> >>> An example of what?
>> >>> On Sat, May 19, 2012 at 2:27 PM, Fabio Ebner <fabioeb...@gmail.com>
>> >>> wrote:
>> >>> > can you send one example? i use ObjectID to create automatic the id.
>> >>> > 2012/5/19 Scott Hernandez <scotthernan...@gmail.com>
>> >>> >> You can use any id generation system you want. By default an
>> >>> >> ObjectID
>> >>> >> is suggested since it doesn't require any interaction with the
>> >>> >> server
>> >>> >> to generate and is unique.
>> >>> >> You can simply pass the (hex) string version of the ObjectId as the
>> >>> >> id
>> >>> >> to your html/web-app; that works just fine.
>> >>> >> If you want to maintain a sequence/counter there are example in the
>> >>> >> docs and an example annotation in morphia you can use. It is not
>> >>> >> suggested as it requires going to the server before every insert to
>> >>> >> get an id.
>> >>> >> On Sat, May 19, 2012 at 11:25 AM, FabioEbner <fabioeb...@gmail.com>
>> >>> >> wrote:
>> >>> >> > Hi, i create one class with morphia.. and put one ObejctID, but i
>> >>> >> > wanna
>> >>> >> > know
>> >>> >> > if i have another ID , something like SGDB id, sequential id,
>> >>> >> > because i
>> >>> >> > need
>> >>> >> > to pass the id to view and than back to front. so i can olny pass
>> >>> >> > the id
>> >>> >> > tks
>> >>> >> > --
>> >>> >> > You received this message because you are subscribed to the
>> >>> >> > Google
>> >>> >> > Groups "mongodb-user" group.
>> >>> >> > To post to this group, send email to
>> >>> >> > mongodb-user@googlegroups.com
>> >>> >> > To unsubscribe from this group, send email to
>> >>> >> > mongodb-user+unsubscribe@googlegroups.com
>> >>> >> > See also the IRC channel -- freenode.net#mongodb
>> >>> >> --
>> >>> >> You received this message because you are subscribed to the Google
>> >>> >> Groups "mongodb-user" group.
>> >>> >> To post to this group, send email to mongodb-user@googlegroups.com
>> >>> >> To unsubscribe from this group, send email to
>> >>> >> mongodb-user+unsubscribe@googlegroups.com
>> >>> >> See also the IRC channel -- freenode.net#mongodb
>> >>> > --
>> >>> > You received this message because you are subscribed to the Google
>> >>> > Groups "mongodb-user" group.
>> >>> > To post to this group, send email to mongodb-user@googlegroups.com
>> >>> > To unsubscribe from this group, send email to
>> >>> > mongodb-user+unsubscribe@googlegroups.com
>> >>> > See also the IRC channel -- freenode.net#mongodb
>> >>> --
>> >>> You received this message because you are subscribed to the Google
>> >>> Groups "mongodb-user" group.
>> >>> To post to this group, send email to mongodb-user@googlegroups.com
>> >>> To unsubscribe from this group, send email to
>> >>> mongodb-user+unsubscribe@googlegroups.com
>> >>> See also the IRC channel -- freenode.net#mongodb
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups "mongodb-user" group.
>> >> To post to this group, send email to mongodb-user@googlegroups.com
>> >> To unsubscribe from this group, send email to
>> >> mongodb-user+unsubscribe@googlegroups.com
>> >> See also the IRC channel -- freenode.net#mongodb
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "mongodb-user" group.
>> > To post to this group, send email to mongodb-user@googlegroups.com
>> > To unsubscribe from this group, send email to
>> > mongodb-user+unsubscribe@googlegroups.com
>> > See also the IRC channel -- freenode.net#mongodb
>> --
>> You received this message because you are subscribed to the Google
>> Groups "mongodb-user" group.
>> To post to this group, send email to mongodb-user@googlegroups.com
>> To unsubscribe from this group, send email to
>> mongodb-user+unsubscribe@googlegroups.com
>> See also the IRC channel -- freenode.net#mongodb
> --
> You received this message because you are subscribed to the Google
> Groups "mongodb-user" group.
> To post to this group, send email to mongodb-user@googlegroups.com
> To unsubscribe from this group, send email to
> mongodb-user+unsubscribe@googlegroups.com
> See also the IRC channel -- freenode.net#mongodb
I am running into the same problem. Let me try to explain I want the unique id to be string, so I can save in browser cookie and retrieve the object when the user comes back. I would rather not use my own unique Id generation as I am not an expert and can possibly generate duplicates, thus messing up the system. If I use ObjectId as recommended, it creates a complex structure that I do not know how to store in the browser. I used ObjectId.getStringMongod() to convert it to a string value to store in cookie, however now I could not figure out a way to retrieve the object using this string value.
On Sunday, May 20, 2012 3:44:05 PM UTC-7, Scott Hernandez wrote:
> If you want to use something other than an ObjectId you can.
> See my first response if you want to use morphia with a > auto-incrementing number.
> On Sun, May 20, 2012 at 6:18 PM, Fabio Ebner <fabioeb...@gmail.com> > wrote: > > Yes, but my id is an ObjectID and this ObjectID have a few properties, > so in > > that way i need to pass the complete ObjectID? > > i want something i just pass one number, not one object
> > did you undestand
> > 2012/5/19 Scott Hernandez <scotthernan...@gmail.com>
> >> On Sat, May 19, 2012 at 4:41 PM, Fabio Ebner <fabioeb...@gmail.com> > wrote: > >> > no..how i use java + morphia to get one data with id.. because i use > >> > java + > >> > morphi
> >> > and my entity i create just like this.
> >> > @id > >> > private ObjectId cdProduct;
> >> > 2012/5/19 Giovanni Fabio <assisten...@gmail.com>
> >> >> SELECT * FROM tablemane WHERE (a=1 OR b=1) AND (a=2 OR b=2)
> >> >> examples of mongodb query > >> >> in mongodb ???
> >> >> 2012/5/19 Scott Hernandez <scotthernan...@gmail.com>
> >> >>> An example of what?
> >> >>> On Sat, May 19, 2012 at 2:27 PM, Fabio Ebner <fabioeb...@gmail.com>
> >> >>> wrote: > >> >>> > can you send one example? i use ObjectID to create automatic the > id.
> >> >>> > 2012/5/19 Scott Hernandez <scotthernan...@gmail.com>
> >> >>> >> You can use any id generation system you want. By default an > >> >>> >> ObjectID > >> >>> >> is suggested since it doesn't require any interaction with the > >> >>> >> server > >> >>> >> to generate and is unique.
> >> >>> >> You can simply pass the (hex) string version of the ObjectId as > the > >> >>> >> id > >> >>> >> to your html/web-app; that works just fine.
> >> >>> >> If you want to maintain a sequence/counter there are example in > the > >> >>> >> docs and an example annotation in morphia you can use. It is not > >> >>> >> suggested as it requires going to the server before every insert > to > >> >>> >> get an id.
> >> >>> >> On Sat, May 19, 2012 at 11:25 AM, FabioEbner < > fabioeb...@gmail.com> > >> >>> >> wrote: > >> >>> >> > Hi, i create one class with morphia.. and put one ObejctID, > but i > >> >>> >> > wanna > >> >>> >> > know > >> >>> >> > if i have another ID , something like SGDB id, sequential id, > >> >>> >> > because i > >> >>> >> > need > >> >>> >> > to pass the id to view and than back to front. so i can olny > pass > >> >>> >> > the id
> >> >>> >> > tks
> >> >>> >> > -- > >> >>> >> > You received this message because you are subscribed to the > >> >>> >> > Google > >> >>> >> > Groups "mongodb-user" group. > >> >>> >> > To post to this group, send email to > >> >>> >> > mongodb-user@googlegroups.com > >> >>> >> > To unsubscribe from this group, send email to > >> >>> >> > mongodb-user+unsubscribe@googlegroups.com > >> >>> >> > See also the IRC channel -- freenode.net#mongodb
> >> >>> >> -- > >> >>> >> You received this message because you are subscribed to the > Google > >> >>> >> Groups "mongodb-user" group. > >> >>> >> To post to this group, send email to > mongodb-user@googlegroups.com > >> >>> >> To unsubscribe from this group, send email to > >> >>> >> mongodb-user+unsubscribe@googlegroups.com > >> >>> >> See also the IRC channel -- freenode.net#mongodb
> >> >>> > -- > >> >>> > You received this message because you are subscribed to the > Google > >> >>> > Groups "mongodb-user" group. > >> >>> > To post to this group, send email to > mongodb-user@googlegroups.com > >> >>> > To unsubscribe from this group, send email to > >> >>> > mongodb-user+unsubscribe@googlegroups.com > >> >>> > See also the IRC channel -- freenode.net#mongodb
> >> >>> -- > >> >>> You received this message because you are subscribed to the Google > >> >>> Groups "mongodb-user" group. > >> >>> To post to this group, send email to mongodb-user@googlegroups.com > >> >>> To unsubscribe from this group, send email to > >> >>> mongodb-user+unsubscribe@googlegroups.com > >> >>> See also the IRC channel -- freenode.net#mongodb
> >> >> -- > >> >> You received this message because you are subscribed to the Google > >> >> Groups "mongodb-user" group. > >> >> To post to this group, send email to mongodb-user@googlegroups.com > >> >> To unsubscribe from this group, send email to > >> >> mongodb-user+unsubscribe@googlegroups.com > >> >> See also the IRC channel -- freenode.net#mongodb
> >> > -- > >> > You received this message because you are subscribed to the Google > >> > Groups "mongodb-user" group. > >> > To post to this group, send email to mongodb-user@googlegroups.com > >> > To unsubscribe from this group, send email to > >> > mongodb-user+unsubscribe@googlegroups.com > >> > See also the IRC channel -- freenode.net#mongodb
> >> -- > >> You received this message because you are subscribed to the Google > >> Groups "mongodb-user" group. > >> To post to this group, send email to mongodb-user@googlegroups.com > >> To unsubscribe from this group, send email to > >> mongodb-user+unsubscribe@googlegroups.com > >> See also the IRC channel -- freenode.net#mongodb
> > -- > > You received this message because you are subscribed to the Google > > Groups "mongodb-user" group. > > To post to this group, send email to mongodb-user@googlegroups.com > > To unsubscribe from this group, send email to > > mongodb-user+unsubscribe@googlegroups.com > > See also the IRC channel -- freenode.net#mongodb
"If I use ObjectId as recommended, it creates a complex structure that I do
not know how to store in the browser."
Complex structure? It's a string, you make the cookie contents equal the
string.
"I used ObjectId.getStringMongod() to convert it to a string value to store
in cookie, however now I could not figure out a way to retrieve the object
using this string value."
You must recast it as an ObjectId using the string as the constructor param.
On 20 July 2012 11:20, ravi <ravikapoor...@gmail.com> wrote:
> I am running into the same problem. Let me try to explain
> I want the unique id to be string, so I can save in browser cookie and
> retrieve the object when the user comes back.
> I would rather not use my own unique Id generation as I am not an expert
> and can possibly generate duplicates, thus messing up the system.
> If I use ObjectId as recommended, it creates a complex structure that I do
> not know how to store in the browser.
> I used ObjectId.getStringMongod() to convert it to a string value to store
> in cookie, however now I could not figure out a way to retrieve the object
> using this string value.
> Hope that clarifies the issue.
> On Sunday, May 20, 2012 3:44:05 PM UTC-7, Scott Hernandez wrote:
>> If you want to use something other than an ObjectId you can.
>> See my first response if you want to use morphia with a
>> auto-incrementing number.
>> On Sun, May 20, 2012 at 6:18 PM, Fabio Ebner <fabioeb...@gmail.com>
>> wrote:
>> > Yes, but my id is an ObjectID and this ObjectID have a few properties,
>> so in
>> > that way i need to pass the complete ObjectID?
>> > i want something i just pass one number, not one object
>> > did you undestand
>> > 2012/5/19 Scott Hernandez <scotthernan...@gmail.com>
>> >> On Sat, May 19, 2012 at 4:41 PM, Fabio Ebner <fabioeb...@gmail.com>
>> wrote:
>> >> > no..how i use java + morphia to get one data with id.. because i use
>> >> > java +
>> >> > morphi
>> >> > and my entity i create just like this.
>> >> > @id
>> >> > private ObjectId cdProduct;
>> >> > 2012/5/19 Giovanni Fabio <assisten...@gmail.com>
>> >> >> SELECT * FROM tablemane WHERE (a=1 OR b=1) AND (a=2 OR b=2)
>> >> >> examples of mongodb query
>> >> >> in mongodb ???
>> >> >> 2012/5/19 Scott Hernandez <scotthernan...@gmail.com>
>> >> >>> An example of what?
>> >> >>> On Sat, May 19, 2012 at 2:27 PM, Fabio Ebner <fabioeb...@gmail.com>
>> >> >>> wrote:
>> >> >>> > can you send one example? i use ObjectID to create automatic the
>> id.
>> >> >>> > 2012/5/19 Scott Hernandez <scotthernan...@gmail.com>
>> >> >>> >> You can use any id generation system you want. By default an
>> >> >>> >> ObjectID
>> >> >>> >> is suggested since it doesn't require any interaction with the
>> >> >>> >> server
>> >> >>> >> to generate and is unique.
>> >> >>> >> You can simply pass the (hex) string version of the ObjectId as
>> the
>> >> >>> >> id
>> >> >>> >> to your html/web-app; that works just fine.
>> >> >>> >> If you want to maintain a sequence/counter there are example in
>> the
>> >> >>> >> docs and an example annotation in morphia you can use. It is
>> not
>> >> >>> >> suggested as it requires going to the server before every
>> insert to
>> >> >>> >> get an id.
>> >> >>> >> On Sat, May 19, 2012 at 11:25 AM, FabioEbner <
>> fabioeb...@gmail.com>
>> >> >>> >> wrote:
>> >> >>> >> > Hi, i create one class with morphia.. and put one ObejctID,
>> but i
>> >> >>> >> > wanna
>> >> >>> >> > know
>> >> >>> >> > if i have another ID , something like SGDB id, sequential id,
>> >> >>> >> > because i
>> >> >>> >> > need
>> >> >>> >> > to pass the id to view and than back to front. so i can olny
>> pass
>> >> >>> >> > the id
>> >> >>> >> > tks
>> >> >>> >> > --
>> >> >>> >> > You received this message because you are subscribed to the
>> >> >>> >> > Google
>> >> >>> >> > Groups "mongodb-user" group.
>> >> >>> >> > To post to this group, send email to
>> >> >>> >> > mongodb-user@googlegroups.com
>> >> >>> >> > To unsubscribe from this group, send email to
>> >> >>> >> > mongodb-user+unsubscribe@**googlegroups.com<mongodb-user%2Bunsubscribe@goog legroups.com>
>> >> >>> >> > See also the IRC channel -- freenode.net#mongodb
>> >> >>> >> --
>> >> >>> >> You received this message because you are subscribed to the
>> Google
>> >> >>> >> Groups "mongodb-user" group.
>> >> >>> >> To post to this group, send email to
>> mongodb-user@googlegroups.com
>> >> >>> >> To unsubscribe from this group, send email to
>> >> >>> >> mongodb-user+unsubscribe@**googlegroups.com<mongodb-user%2Bunsubscribe@goog legroups.com>
>> >> >>> >> See also the IRC channel -- freenode.net#mongodb
>> >> >>> > --
>> >> >>> > You received this message because you are subscribed to the
>> Google
>> >> >>> > Groups "mongodb-user" group.
>> >> >>> > To post to this group, send email to
>> mongodb-user@googlegroups.com
>> >> >>> > To unsubscribe from this group, send email to
>> >> >>> > mongodb-user+unsubscribe@**googlegroups.com<mongodb-user%2Bunsubscribe@goog legroups.com>
>> >> >>> > See also the IRC channel -- freenode.net#mongodb
>> >> >>> --
>> >> >>> You received this message because you are subscribed to the Google
>> >> >>> Groups "mongodb-user" group.
>> >> >>> To post to this group, send email to mongodb-user@googlegroups.com
>> >> >>> To unsubscribe from this group, send email to
>> >> >>> mongodb-user+unsubscribe@**googlegroups.com<mongodb-user%2Bunsubscribe@goog legroups.com>
>> >> >>> See also the IRC channel -- freenode.net#mongodb
>> >> >> --
>> >> >> You received this message because you are subscribed to the Google
>> >> >> Groups "mongodb-user" group.
>> >> >> To post to this group, send email to mongodb-user@googlegroups.com
>> >> >> To unsubscribe from this group, send email to
>> >> >> mongodb-user+unsubscribe@**googlegroups.com<mongodb-user%2Bunsubscribe@goog legroups.com>
>> >> >> See also the IRC channel -- freenode.net#mongodb
>> >> > --
>> >> > You received this message because you are subscribed to the Google
>> >> > Groups "mongodb-user" group.
>> >> > To post to this group, send email to mongodb-user@googlegroups.com
>> >> > To unsubscribe from this group, send email to
>> >> > mongodb-user+unsubscribe@**googlegroups.com<mongodb-user%2Bunsubscribe@goog legroups.com>
>> >> > See also the IRC channel -- freenode.net#mongodb
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups "mongodb-user" group.
>> >> To post to this group, send email to mongodb-user@googlegroups.com
>> >> To unsubscribe from this group, send email to
>> >> mongodb-user+unsubscribe@**googlegroups.com<mongodb-user%2Bunsubscribe@goog legroups.com>
>> >> See also the IRC channel -- freenode.net#mongodb
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "mongodb-user" group.
>> > To post to this group, send email to mongodb-user@googlegroups.com
>> > To unsubscribe from this group, send email to
>> > mongodb-user+unsubscribe@**googlegroups.com<mongodb-user%2Bunsubscribe@goog legroups.com>
>> > See also the IRC channel -- freenode.net#mongodb
> --
> You received this message because you are subscribed to the Google
> Groups "mongodb-user" group.
> To post to this group, send email to mongodb-user@googlegroups.com
> To unsubscribe from this group, send email to
> mongodb-user+unsubscribe@googlegroups.com
> See also the IRC channel -- freenode.net#mongodb
Thanks for helping Sammaye, I am still unable to retrieve the object. Here is my situation:
1. ObjectId when converted to JSON results in - {"time":1342807473000,"new":false,"machine":-1045725356,"timeSecond":134280 7473,"inc":-208935720} I am not sure why it converts simple string to complex structure, but somehow it does. Though is not relevant anymore. I am getting string value using id.toStringMongod()
2. I tried all the following method to retrieve the object back. ALL of them fail. I cant seem to get the syntax right. Help please.
On Friday, July 20, 2012 7:07:45 AM UTC-7, Sammaye wrote:
> "If I use ObjectId as recommended, it creates a complex structure that I > do not know how to store in the browser."
> Complex structure? It's a string, you make the cookie contents equal the > string.
> "I used ObjectId.getStringMongod() to convert it to a string value to > store in cookie, however now I could not figure out a way to retrieve the > object using this string value."
> You must recast it as an ObjectId using the string as the constructor > param.
> On 20 July 2012 11:20, ravi <ravikapoor...@gmail.com> wrote:
>> I am running into the same problem. Let me try to explain >> I want the unique id to be string, so I can save in browser cookie and >> retrieve the object when the user comes back. >> I would rather not use my own unique Id generation as I am not an expert >> and can possibly generate duplicates, thus messing up the system. >> If I use ObjectId as recommended, it creates a complex structure that I >> do not know how to store in the browser. >> I used ObjectId.getStringMongod() to convert it to a string value to >> store in cookie, however now I could not figure out a way to retrieve the >> object using this string value.
>> Hope that clarifies the issue.
>> On Sunday, May 20, 2012 3:44:05 PM UTC-7, Scott Hernandez wrote:
>>> If you want to use something other than an ObjectId you can.
>>> See my first response if you want to use morphia with a >>> auto-incrementing number.
>>> On Sun, May 20, 2012 at 6:18 PM, Fabio Ebner <fabioeb...@gmail.com> >>> wrote: >>> > Yes, but my id is an ObjectID and this ObjectID have a few properties, >>> so in >>> > that way i need to pass the complete ObjectID? >>> > i want something i just pass one number, not one object
>>> > did you undestand
>>> > 2012/5/19 Scott Hernandez <scotthernan...@gmail.com>
>>> >> On Sat, May 19, 2012 at 4:41 PM, Fabio Ebner <fabioeb...@gmail.com> >>> wrote: >>> >> > no..how i use java + morphia to get one data with id.. because i >>> use >>> >> > java + >>> >> > morphi
>>> >> > and my entity i create just like this.
>>> >> > @id >>> >> > private ObjectId cdProduct;
>>> >> > 2012/5/19 Giovanni Fabio <assisten...@gmail.com>
>>> >> >> SELECT * FROM tablemane WHERE (a=1 OR b=1) AND (a=2 OR b=2)
>>> >> >> examples of mongodb query >>> >> >> in mongodb ???
>>> >> >> 2012/5/19 Scott Hernandez <scotthernan...@gmail.com>
>>> >> >>> An example of what?
>>> >> >>> On Sat, May 19, 2012 at 2:27 PM, Fabio Ebner < >>> fabioeb...@gmail.com> >>> >> >>> wrote: >>> >> >>> > can you send one example? i use ObjectID to create automatic >>> the id.
>>> >> >>> > 2012/5/19 Scott Hernandez <scotthernan...@gmail.com>
>>> >> >>> >> You can use any id generation system you want. By default an >>> >> >>> >> ObjectID >>> >> >>> >> is suggested since it doesn't require any interaction with the >>> >> >>> >> server >>> >> >>> >> to generate and is unique.
>>> >> >>> >> You can simply pass the (hex) string version of the ObjectId >>> as the >>> >> >>> >> id >>> >> >>> >> to your html/web-app; that works just fine.
>>> >> >>> >> If you want to maintain a sequence/counter there are example >>> in the >>> >> >>> >> docs and an example annotation in morphia you can use. It is >>> not >>> >> >>> >> suggested as it requires going to the server before every >>> insert to >>> >> >>> >> get an id.
>>> >> >>> >> On Sat, May 19, 2012 at 11:25 AM, FabioEbner < >>> fabioeb...@gmail.com> >>> >> >>> >> wrote: >>> >> >>> >> > Hi, i create one class with morphia.. and put one ObejctID, >>> but i >>> >> >>> >> > wanna >>> >> >>> >> > know >>> >> >>> >> > if i have another ID , something like SGDB id, sequential >>> id, >>> >> >>> >> > because i >>> >> >>> >> > need >>> >> >>> >> > to pass the id to view and than back to front. so i can olny >>> pass >>> >> >>> >> > the id
>>> >> >>> >> > tks
>>> >> >>> >> > -- >>> >> >>> >> > You received this message because you are subscribed to the >>> >> >>> >> > Google >>> >> >>> >> > Groups "mongodb-user" group. >>> >> >>> >> > To post to this group, send email to >>> >> >>> >> > mongodb-user@googlegroups.com >>> >> >>> >> > To unsubscribe from this group, send email to >>> >> >>> >> > mongodb-user+unsubscribe@**googlegroups.com<mongodb-user%2Bunsubscribe@goog legroups.com> >>> >> >>> >> > See also the IRC channel -- freenode.net#mongodb
>>> >> >>> >> -- >>> >> >>> >> You received this message because you are subscribed to the >>> Google >>> >> >>> >> Groups "mongodb-user" group. >>> >> >>> >> To post to this group, send email to >>> mongodb-user@googlegroups.com >>> >> >>> >> To unsubscribe from this group, send email to >>> >> >>> >> mongodb-user+unsubscribe@**googlegroups.com<mongodb-user%2Bunsubscribe@goog legroups.com> >>> >> >>> >> See also the IRC channel -- freenode.net#mongodb
>>> >> >>> > -- >>> >> >>> > You received this message because you are subscribed to the >>> Google >>> >> >>> > Groups "mongodb-user" group. >>> >> >>> > To post to this group, send email to >>> mongodb-user@googlegroups.com >>> >> >>> > To unsubscribe from this group, send email to >>> >> >>> > mongodb-user+unsubscribe@**googlegroups.com<mongodb-user%2Bunsubscribe@goog legroups.com> >>> >> >>> > See also the IRC channel -- freenode.net#mongodb
>>> >> >>> -- >>> >> >>> You received this message because you are subscribed to the >>> Google >>> >> >>> Groups "mongodb-user" group. >>> >> >>> To post to this group, send email to >>> mongodb-user@googlegroups.com >>> >> >>> To unsubscribe from this group, send email to >>> >> >>> mongodb-user+unsubscribe@**googlegroups.com<mongodb-user%2Bunsubscribe@goog legroups.com> >>> >> >>> See also the IRC channel -- freenode.net#mongodb
>>> >> >> -- >>> >> >> You received this message because you are subscribed to the Google >>> >> >> Groups "mongodb-user" group. >>> >> >> To post to this group, send email to mongodb-user@googlegroups.com >>> >> >> To unsubscribe from this group, send email to >>> >> >> mongodb-user+unsubscribe@**googlegroups.com<mongodb-user%2Bunsubscribe@goog legroups.com> >>> >> >> See also the IRC channel -- freenode.net#mongodb
>>> >> > -- >>> >> > You received this message because you are subscribed to the Google >>> >> > Groups "mongodb-user" group. >>> >> > To post to this group, send email to mongodb-user@googlegroups.com >>> >> > To unsubscribe from this group, send email to >>> >> > mongodb-user+unsubscribe@**googlegroups.com<mongodb-user%2Bunsubscribe@goog legroups.com> >>> >> > See also the IRC channel -- freenode.net#mongodb
>>> >> -- >>> >> You received this message because you are subscribed to the Google >>> >> Groups "mongodb-user" group. >>> >> To post to this group, send email to mongodb-user@googlegroups.com >>> >> To unsubscribe from this group, send email to >>> >> mongodb-user+unsubscribe@**googlegroups.com<mongodb-user%2Bunsubscribe@goog legroups.com> >>> >> See also the IRC channel -- freenode.net#mongodb
>>> > -- >>> > You received this message because you are subscribed to the Google >>> > Groups "mongodb-user" group. >>> > To post to this group, send email to mongodb-user@googlegroups.com >>> > To unsubscribe from this group, send email to >>> > mongodb-user+unsubscribe@**googlegroups.com<mongodb-user%2Bunsubscribe@goog legroups.com> >>> > See also the IRC channel -- freenode.net#mongodb
>> -- >> You received this message because you are subscribed to
Wow, finally figured it out after hours of work. Here is the code for other newbies out there ----------------------------------- @Entity("users") public class User { @Id ObjectId id;
}
----------------------------------- Mongo mongo = new Mongo(); Morphia morphia = new Morphia(); morphia.map(User.class); Datastore ds = morphia.createDatastore(mongo, "abcd"); // saving a user User user = new User(); user.name = "idiot"; user.save() // get id for future as follows String userId = user.id.toStringMongod() // now retrieve the same user back from DB Query q1 = ds.createQuery(User.class).field("id").equal(new ObjectId(userId)); User user1 = q1.get();
----------------------------------- Hope that helps somebody out there on the internets
On Friday, July 20, 2012 11:30:09 AM UTC-7, ravi wrote:
> Thanks for helping Sammaye, I am still unable to retrieve the object. Here > is my situation:
> 1. ObjectId when converted to JSON results in > - {"time":1342807473000,"new":false,"machine":-1045725356,"timeSecond":134280 7473,"inc":-208935720} > I am not sure why it converts simple string to complex structure, but > somehow it does. Though is not relevant anymore. I am getting string value > using id.toStringMongod()
> 2. I tried all the following method to retrieve the object back. ALL of > them fail. I cant seem to get the syntax right. Help please.
> query = ds.find(User.class).filter("_id", "ObjectId(\"" + id + "\")" ); > user1 = query.get(); > user1 = ds.get(User.class, new ObjectId(id));
> All of them print user = null. :( > thanks
> On Friday, July 20, 2012 7:07:45 AM UTC-7, Sammaye wrote:
>> "If I use ObjectId as recommended, it creates a complex structure that I >> do not know how to store in the browser."
>> Complex structure? It's a string, you make the cookie contents equal the >> string.
>> "I used ObjectId.getStringMongod() to convert it to a string value to >> store in cookie, however now I could not figure out a way to retrieve the >> object using this string value."
>> You must recast it as an ObjectId using the string as the constructor >> param.
>> On 20 July 2012 11:20, ravi <ravikapoor...@gmail.com> wrote:
>>> I am running into the same problem. Let me try to explain >>> I want the unique id to be string, so I can save in browser cookie and >>> retrieve the object when the user comes back. >>> I would rather not use my own unique Id generation as I am not an expert >>> and can possibly generate duplicates, thus messing up the system. >>> If I use ObjectId as recommended, it creates a complex structure that I >>> do not know how to store in the browser. >>> I used ObjectId.getStringMongod() to convert it to a string value to >>> store in cookie, however now I could not figure out a way to retrieve the >>> object using this string value.
>>> Hope that clarifies the issue.
>>> On Sunday, May 20, 2012 3:44:05 PM UTC-7, Scott Hernandez wrote:
>>>> If you want to use something other than an ObjectId you can.
>>>> See my first response if you want to use morphia with a >>>> auto-incrementing number.
>>>> On Sun, May 20, 2012 at 6:18 PM, Fabio Ebner <fabioeb...@gmail.com> >>>> wrote: >>>> > Yes, but my id is an ObjectID and this ObjectID have a few >>>> properties, so in >>>> > that way i need to pass the complete ObjectID? >>>> > i want something i just pass one number, not one object
>>>> > did you undestand
>>>> > 2012/5/19 Scott Hernandez <scotthernan...@gmail.com>
>>>> >> On Sat, May 19, 2012 at 4:41 PM, Fabio Ebner <fabioeb...@gmail.com> >>>> wrote: >>>> >> > no..how i use java + morphia to get one data with id.. because i >>>> use >>>> >> > java + >>>> >> > morphi
>>>> >> > 2012/5/19 Giovanni Fabio <assisten...@gmail.com>
>>>> >> >> SELECT * FROM tablemane WHERE (a=1 OR b=1) AND (a=2 OR b=2)
>>>> >> >> examples of mongodb query >>>> >> >> in mongodb ???
>>>> >> >> 2012/5/19 Scott Hernandez <scotthernan...@gmail.com>
>>>> >> >>> An example of what?
>>>> >> >>> On Sat, May 19, 2012 at 2:27 PM, Fabio Ebner < >>>> fabioeb...@gmail.com> >>>> >> >>> wrote: >>>> >> >>> > can you send one example? i use ObjectID to create automatic >>>> the id.
>>>> >> >>> > 2012/5/19 Scott Hernandez <scotthernan...@gmail.com>
>>>> >> >>> >> You can use any id generation system you want. By default an >>>> >> >>> >> ObjectID >>>> >> >>> >> is suggested since it doesn't require any interaction with >>>> the >>>> >> >>> >> server >>>> >> >>> >> to generate and is unique.
>>>> >> >>> >> You can simply pass the (hex) string version of the ObjectId >>>> as the >>>> >> >>> >> id >>>> >> >>> >> to your html/web-app; that works just fine.
>>>> >> >>> >> If you want to maintain a sequence/counter there are example >>>> in the >>>> >> >>> >> docs and an example annotation in morphia you can use. It is >>>> not >>>> >> >>> >> suggested as it requires going to the server before every >>>> insert to >>>> >> >>> >> get an id.
>>>> >> >>> >> On Sat, May 19, 2012 at 11:25 AM, FabioEbner < >>>> fabioeb...@gmail.com> >>>> >> >>> >> wrote: >>>> >> >>> >> > Hi, i create one class with morphia.. and put one ObejctID, >>>> but i >>>> >> >>> >> > wanna >>>> >> >>> >> > know >>>> >> >>> >> > if i have another ID , something like SGDB id, sequential >>>> id, >>>> >> >>> >> > because i >>>> >> >>> >> > need >>>> >> >>> >> > to pass the id to view and than back to front. so i can >>>> olny pass >>>> >> >>> >> > the id
>>>> >> >>> >> > tks
>>>> >> >>> >> > -- >>>> >> >>> >> > You received this message because you are subscribed to the >>>> >> >>> >> > Google >>>> >> >>> >> > Groups "mongodb-user" group. >>>> >> >>> >> > To post to this group, send email to >>>> >> >>> >> > mongodb-user@googlegroups.com >>>> >> >>> >> > To unsubscribe from this group, send email to >>>> >> >>> >> > mongodb-user+unsubscribe@**googlegroups.com<mongodb-user%2Bunsubscribe@goog legroups.com> >>>> >> >>> >> > See also the IRC channel -- freenode.net#mongodb
>>>> >> >>> >> -- >>>> >> >>> >> You received this message because you are subscribed to the >>>> Google >>>> >> >>> >> Groups "mongodb-user" group. >>>> >> >>> >> To post to this group, send email to >>>> mongodb-user@googlegroups.com >>>> >> >>> >> To unsubscribe from this group, send email to >>>> >> >>> >> mongodb-user+unsubscribe@**googlegroups.com<mongodb-user%2Bunsubscribe@goog legroups.com> >>>> >> >>> >> See also the IRC channel -- freenode.net#mongodb
>>>> >> >>> > -- >>>> >> >>> > You received this message because you are subscribed to the >>>> Google >>>> >> >>> > Groups "mongodb-user" group. >>>> >> >>> > To post to this group, send email to >>>> mongodb-user@googlegroups.com >>>> >> >>> > To unsubscribe from this group, send email to >>>> >> >>> > mongodb-user+unsubscribe@**googlegroups.com<mongodb-user%2Bunsubscribe@goog legroups.com> >>>> >> >>> > See also the IRC channel -- freenode.net#mongodb
>>>> >> >>> -- >>>> >> >>> You received this message because you are subscribed to the >>>> Google >>>> >> >>> Groups "mongodb-user" group. >>>> >> >>> To post to this group, send email to >>>> mongodb-user@googlegroups.com >>>> >> >>> To unsubscribe from this group, send email to >>>> >> >>> mongodb-user+unsubscribe@**googlegroups.com<mongodb-user%2Bunsubscribe@goog legroups.com> >>>> >> >>> See also the IRC channel -- freenode.net#mongodb
>>>> >> >> -- >>>> >> >> You received this message because you are subscribed to the >>>> Google >>>> >> >> Groups "mongodb-user" group. >>>> >> >> To post to this group, send email to >>>> mongodb-user@googlegroups.com >>>> >> >> To unsubscribe from this group, send email to >>>> >> >> mongodb-user+unsubscribe@**googlegroups.com<mongodb-user%2Bunsubscribe@goog legroups.com> >>>> >> >> See also the IRC channel -- freenode.net#mongodb
>>>> >> > -- >>>> >> > You received this message because you are subscribed to the Google >>>> >> > Groups "mongodb-user" group. >>>> >> > To post to this group, send email to mongodb-user@googlegroups.com >>>> >> > To