Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

how do i add column in mongo db

Posted on 2015-11-25
12
Medium Priority
?
133 Views
Last Modified: 2016-02-10
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
Comment
Question by:chalie001
  • 6
  • 6
12 Comments
 
LVL 16

Expert Comment

by:gurpsbassi
ID: 41317225
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
 

Author Comment

by:chalie001
ID: 41323968
mongo
i did this but no luck
0
 
LVL 16

Expert Comment

by:gurpsbassi
ID: 41324164
The sceenshot you supplied has a collection of BSON documents. What query did you use to produce it?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:chalie001
ID: 41332764
I did not do that somebody did that
0
 
LVL 16

Expert Comment

by:gurpsbassi
ID: 41332845
Having executed the update , I need to see the output of findall.
0
 

Author Comment

by:chalie001
ID: 41333884
Where do I execute the update
0
 
LVL 16

Expert Comment

by:gurpsbassi
ID: 41334124
Chalie001 your not listening.

You have already executed the update.

How do you know it hasn't worked?
0
 

Author Comment

by:chalie001
ID: 41337685
because the field is not added
0
 
LVL 16

Expert Comment

by:gurpsbassi
ID: 41338224
how can you tell?
did you run a query? show me the query and the results!!!!!!
0
 

Author Comment

by:chalie001
ID: 41339026
tablethis is my table
0
 
LVL 16

Accepted Solution

by:
gurpsbassi earned 2000 total points
ID: 41339325
your table looks empty
how about adding a document and then running the update
0
 

Author Comment

by:chalie001
ID: 41345914
i did thanks
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
Six Sigma Control Plans
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question