Question
a.
function insertData(dbName, colName, num)
{
var col = db.getSiblingDB(dbName).getCollection(colName);
for (i = 0; i < num; i++)
{
col.insertData({x:i});
}
print(col.count());
}
b.
function insertData(dbName, colName, num)
{
var col = db.getSiblingDB(dbName).getCollection(colName);
for (i = 0; i < num; i++)
{
col.insert({x:i});
}
print(col.count());
}
c.
insertData(dbName, colName, num)
{
var col = db.getSiblingDB(dbName).getCollection(colName);
for (i = 0; i < num; i++)
{
col.insert({x:i});
}
print(col.count());
}
d.
None of the mentioned
Posted under MongoDB
{
var col = db.getSiblingDB(dbName).getCollection(colName);
for (i = 0; i < num; i++)
{
col.insert({x:i});
}
print(col.count());
}
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. Which of the following function is valid for creation of new data inside MongoDB Shell?
Similar Questions
Discover Related MCQs
Q. Point out the wrong statement.
View solution
Q. _id is a ________ bytes hexadecimal number which assures the uniqueness of every document.
View solution
Q. Which of the following statement will insert 400 documents in to the testData collection?
View solution
Q. The mongo shell loads and parses the ___________ file on startup.
View solution
Q. To iterate the cursor and return more documents, type _________ in the mongo shell.
View solution
Q. Which of the following key is used to denote uniqueness in the collection?
View solution
Q. A query may include a ___________ that specifies the fields from the matching documents to return.
View solution
Q. Point out the correct statement.
View solution
Q. MongoDB stores all documents in _____________
View solution
Q. In MongoDB _________ operations modify the data of a single collection.
View solution
Q. Point out the wrong statement.
View solution
Q. Which of the following operation adds a new document to the users collection?
View solution
Q. Which of the following preference determines how the client direct read operations to the set?
View solution
Q. Applications can also control the behavior of write operations using _______ concern.
View solution
Q. MongoDB process collection of documents using _________ operations.
View solution
Q. Which of the following pipeline is used for aggregation in MongoDB?
View solution
Q. The order of documents returned by a query is not defined unless you specify a ______
View solution
Q. Point out the correct statement.
View solution
Q. In aggregation pipeline, the _______ pipeline stage provides access to MongoDB queries.
View solution
Q. Which of the following method returns one document?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond MongoDB? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!