top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Mention the command to insert the following document in a database called school and collection called persons..?

+1 vote
258 views
Mention the command to insert the following document in a database called school and collection called persons..?
posted Mar 1, 2016 by Jishnu Ramachandran

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Hi Jishnu I think question is incomplete but to insert any document with given details like you have,
Database Name: school and Collection name: persons
In mongoTerminal use code

use school;
db.persons.insert({"DataToInsertKey":"ValueOfData"}); 
answer Mar 1, 2016 by Shivam Kumar Pandey
Similar Questions
+1 vote

Query description: I have a collection name student_db and added a document in a collection with entries (name: "alok, age : 31 and profession: "xyz"). After inserting the document into student_db database, I want to add another (key:value ) pair i.e. salary: 50000.

Can someone help me out to resolve this problem ?

...