Skip to content

Commit 08724fb

Browse files
committed
Update README.md
1 parent a90d401 commit 08724fb

File tree

1 file changed

+1
-63
lines changed

1 file changed

+1
-63
lines changed

README.md

Lines changed: 1 addition & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -506,17 +506,6 @@ MongoDB stores BSON (Binary Interchange and Structure Object Notation) objects i
506506
<b><a href="#">↥ back to top</a></b>
507507
</div>
508508
509-
## Q. ***Mention the command to insert a document in a database called school and collection called persons?***
510-
511-
```js
512-
use school;
513-
db.persons.insert( { name: "Alex", age: "28" } )
514-
```
515-
516-
<div align="right">
517-
<b><a href="#">↥ back to top</a></b>
518-
</div>
519-
520509
## Q. ***What is Replication in Mongodb?***
521510
522511
Replication exists primarily to offer data redundancy and high availability. It maintain the durability of data by keeping multiple copies or replicas of that data on physically isolated servers. Replication allows to increase data availability by creating multiple copies of data across servers. This is especially useful if a server crashes or hardware failure.
@@ -1184,65 +1173,14 @@ As cursor is not isolated during its lifetime, thus intervening write operations
11841173
<b><a href="#">↥ back to top</a></b>
11851174
</div>
11861175
1187-
#### Q. ***At what interval does MongoDB write updates to the disk?***
1176+
## Q. ***At what interval does MongoDB write updates to the disk?***
11881177
11891178
By default configuration, MongoDB writes updates to the disk every 60 seconds. However, this is configurable with the `commitIntervalMs` and `syncPeriodSecs` options.
11901179
11911180
<div align="right">
11921181
<b><a href="#">↥ back to top</a></b>
11931182
</div>
11941183
1195-
## Q. ***Mention the command to remove indexes and list all the indexes on a particular collection?***
1196-
1197-
**List all Indexes on a Collection**
1198-
1199-
```js
1200-
// To view all indexes on the people collection
1201-
1202-
db.people.getIndexes()
1203-
```
1204-
1205-
**List all Indexes for a Database**
1206-
1207-
```js
1208-
// To list all the collection indexes in a database
1209-
1210-
db.getCollectionNames().forEach(function(collection) {
1211-
indexes = db[collection].getIndexes();
1212-
print("Indexes for " + collection + ":");
1213-
printjson(indexes);
1214-
});
1215-
```
1216-
1217-
**Remove Indexes**
1218-
1219-
MongoDB provides two methods for removing indexes from a collection:
1220-
1221-
* `db.collection.dropIndex()`
1222-
* `db.collection.dropIndexes()`
1223-
1224-
**1. Remove Specific Index**
1225-
1226-
```js
1227-
db.accounts.dropIndex( { "tax-id": 1 } )
1228-
1229-
1230-
// Output
1231-
{ "nIndexesWas" : 3, "ok" : 1 }
1232-
```
1233-
1234-
**2. Remove All Indexes**
1235-
1236-
```js
1237-
// The following command removes all indexes from the accounts collection
1238-
1239-
db.accounts.dropIndexes()
1240-
```
1241-
1242-
<div align="right">
1243-
<b><a href="#">↥ back to top</a></b>
1244-
</div>
1245-
12461184
## Q. ***What happens if an index does not fit into RAM?***
12471185
12481186
If the indexes does not fit into RAM, MongoDB reads data from disk which is relatively very much slower than reading from RAM.

0 commit comments

Comments
 (0)