top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

MongoDB: Can a user insert same document multiple times in same collection ?

+1 vote
337 views
MongoDB: Can a user insert same document multiple times in same collection ?
posted Jun 23, 2015 by Vikram Singh

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

1 Answer

0 votes

Answer is "Yes".
A user can insert same document multiple times within a collection but system generates an unique "_id" for each document.

answer Jun 23, 2015 by Neeraj Mishra
Similar Questions
+2 votes

suppose, I have an existing capped collection with the following syntax.

db.createCollection("mycappedCollection",{capped: true, size: 2, max:2})

Now, what i want is to modify the above collection and add the autoIndexId option.
like:

db.createCollection("mycappedCollection",{capped: true, autoIndexId: true, size: 2, max:2})

How can I modify the existing mycappedCollection?

...