Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-3169

Suggestion for /manual/reference/operator/query/type/

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: v1.3.11
    • Component/s: manual
    • Labels:
    • # Replies:
      2
    • Last comment by Customer:
      true
    • Actual Time:
      8

      Description

      General: This article spends about three lines talking about the main use case of $type, and the rest talking about the corner cases of (1) looking for an array, and (2) MinKey.

      If the field holds an array, the $type operator performs the type check against the array elements and not the field.

      This is not clear to a novice: does it check that all array elements have the type, or at least one does?

      Min key 255

      There's a warning block below the table that MinKey needs to be queried as -1, not 255. Consider adding a note to the table.

      Where is the value 255 used at all?

      MinKey and MaxKey compare less than and greater than all other possible BSON element values, respectively, and exist primarily for internal use.

      Fine, but why is half the article discussing how to manipulate them?

      Storing values of the different types in the same field in a collection is strongly discouraged.

      (1) Grammar: "of different types", not "of the different types".

      (2) It is not clear what is strongly discouraged. Do you mean that it's bad to have two documents whose x field has different types, like this:

       {_id:1, x: 1} {_id:2, x: "bad?"} 

      Or do you mean that it's bad to have one document whose x field is an array containing different-typed elements, like this:

       {_id:3, x: [3, "different bad!"]} 

      Word this clearly and give an example.

      Also, indicating why it's bad would be helpful too.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since reply:
                5 years, 30 weeks ago
                Date of 1st Reply: