nerdexam
Oracle

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…

JSON

Question

Examine these MySQL Shell statements:

What is the true about the attempts to add document to the collection?

Exhibit

1Z0-909 question #54 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)
  • A
    2% (1)
  • B
    9% (5)
  • C
    4% (2)
  • D
    2% (1)
  • E
    84% (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

#MySQL Shell#Document Collections#Schema Flexibility#JSON Documents

Community Discussion

No community discussion yet for this question.

Full 1Z0-909 Practice