• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 203
  • Last Modified:

how do i add column in mongo db

hi how do i add column in mongo db where do i run this
db.your_collection.update({},{$set : {"new_field":1}},false,true)
0
chalie001
Asked:
chalie001
  • 6
  • 6
1 Solution
 
gurpsbassiCommented:
hi how do i add column in mongo db
mongodb does not have concept of columns. It is document oriented with key value pairs

where do i run this
anywhere that has a connection to mongodb e.g. your java program or mongo viewer e.t.c
0
 
chalie001Author Commented:
mongo
i did this but no luck
0
 
gurpsbassiCommented:
The sceenshot you supplied has a collection of BSON documents. What query did you use to produce it?
0
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

 
chalie001Author Commented:
I did not do that somebody did that
0
 
gurpsbassiCommented:
Having executed the update , I need to see the output of findall.
0
 
chalie001Author Commented:
Where do I execute the update
0
 
gurpsbassiCommented:
Chalie001 your not listening.

You have already executed the update.

How do you know it hasn't worked?
0
 
chalie001Author Commented:
because the field is not added
0
 
gurpsbassiCommented:
how can you tell?
did you run a query? show me the query and the results!!!!!!
0
 
chalie001Author Commented:
tablethis is my table
0
 
gurpsbassiCommented:
your table looks empty
how about adding a document and then running the update
0
 
chalie001Author Commented:
i did thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

  • 6
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now