1Z0-909 · Question #54
Examine these MySQL Shell statements: What is the true about the attempts to add document to the collection?
The correct answer is E. All documents are added and cause a warning. MySQL Shell's X DevAPI document collections are schema-flexible by design - unlike relational tables, collections do not enforce a fixed structure across documents. When documents with different field counts or field names are inserted, MySQL does not reject them; instead, it…
Question
Examine these MySQL Shell statements:
What is the true about the attempts to add document to the collection?
Exhibit
Options
- AAll documents are added without any error or warning.
- BFirst three documents are added, then different number of fields cause an error.
- CFirst two documents are added, then mismatched field names cause an error.
- DFirst two documents are added, then mismatched field names cause a warning.
- EAll documents are added and cause a warning.
How the community answered
(55 responses)- A2% (1)
- B9% (5)
- C4% (2)
- D2% (1)
- E84% (46)
Explanation
MySQL Shell's X DevAPI document collections are schema-flexible by design - unlike relational tables, collections do not enforce a fixed structure across documents. When documents with different field counts or field names are inserted, MySQL does not reject them; instead, it may issue warnings to alert the user about structural inconsistencies, but all insertions still complete successfully.
Why the distractors fail:
- A is wrong because warnings are generated - the operation isn't entirely clean.
- B is wrong because differing field counts do not cause errors; schema flexibility explicitly permits this.
- C is wrong because mismatched field names also do not cause errors in a document collection - they are valid JSON variations.
- D is closest but still wrong: it incorrectly implies that only the first two documents are added, when in reality all documents are inserted regardless of the warning.
Memory tip: Think of MySQL document collections as "warning-friendly, error-tolerant." The mantra is: warnings warn, but don't block. If you see schema differences in a collection context, map it to a warning - not a stop sign. Errors in MySQL Shell document operations are reserved for syntax failures or constraint violations, not structural variation between documents.
Topics
Community Discussion
No community discussion yet for this question.
