I used this comment
> db.createCollection("naveen",{capped:true,autoIndexId:true,size:53440099,max:1000});
and I got this:
{
"note" : "the autoIndexId option is deprecated and will be removed in a future release",
"ok" : 1
}
In fact, MongoDB doesn't need to create a collection, when you insert document MongoDB will automatically create a collection for you, and also generate unique Id for each document!
Example:
db.createCollection("naveen",{capped:true,autoIndexId:true,size:53440099,max:1000}); //don't
you don't need to create a collection, you just need to insert a direct document, it's not like SQL, It's JSON.
{ name: 'john', ...}
like this, insert document without creating a collection, it automatically generates a collection for you!
db.newYear.insert({ name: 'john', age: 33, year: 2020 });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With