• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to insert into MongoDB

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I don't know if this the right forum for asking this type of question.

In mysql I use to do:

Can anyone tell me how can I do that in mongodb?
I am getting the firstName and lastName from HTML form,
by "request.getParameter" and want to pass these values through Servlet to mongodb.

Thanks

 
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would first try a tutorial mongodb tutorial java
 
malik ge
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wendy Gibbons, I have a little knowledge about this:


but most of the tutorials I have found does the above.
What I wanna know if some new user with
name "James",
surname"Bond",
age 23
enters his information in the html form,
then how can I pass that to mongodb.

Means, how can I pass this information through "doc" object
doc.put("name" , ???);
doc.put("surname" , ???);
doc.put("age" , ???);
 
Wendy L Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
which part is confusing you? how to get the details from the web form to the servlet or how to get the details from the servlet into the mongo database?
 
malik ge
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

how to get the details from the servlet into the mongo database?



I know by using Stirng name = request.getParameter("name"), I can get the name of the user.
but don't know how to insert that name, in the following code:
doc.put("name" , ???);
 
Wendy L Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

malik ge wrote:

how to get the details from the servlet into the mongo database?



I know by using Stirng name = request.getParameter("name"), I can get the name of the user.
but don't know how to insert that name, in the following code:
doc.put("name" , ???);



in your code have you tried
doc.put("name", name)?
 
malik ge
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Thanks a lot.
reply
    Bookmark Topic Watch Topic
  • New Topic