InterviewSolution
Saved Bookmarks
| 1. |
How can we migrate primary shards in the sharded clusters? |
|
Answer» Multikey indexes can be used for SUPPORTING efficient querying against array fields. MongoDB creates an index KEY for each element in the array. Note: MongoDB will AUTOMATICALLY create a multikey index if any indexed field is an array, no separate indication required. Consider the startups collection with array of skills { _id: 1, name: "XYZ Technology", skills: [ "Big Data", "AI", “Cloud” ] }Multikey indexes allow to search on the values in the skills array db.startups.createIndex( { skills : 1 } )The query db.startups.find( { skills : "AI" } ) will use this index on skills to RETURN the matching document |
|