[DOCS-3169] Suggestion for /manual/reference/operator/query/type/ Created: 15/Apr/14  Updated: 16/Mar/15  Resolved: 16/Sep/14

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: None
Fix Version/s: v1.3.11

Type: Improvement Priority: Minor - P4
Reporter: bard.bloom@10gen.com Assignee: Andrew Aldridge
Resolution: Done Votes: 0
Labels: audit-2014
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 9 years, 22 weeks, 2 days ago

 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.



 Comments   
Comment by Githook User [ 16/Sep/14 ]

Author:

{u'username': u'tychoish', u'name': u'Sam Kleinman', u'email': u'samk@10gen.com'}

Message: DOCS-3169: organization and edits
Branch: master
https://github.com/mongodb/docs/commit/0e7ee184fb69f3f81eb15ac27010351c73a60275

Comment by Githook User [ 16/Sep/14 ]

Author:

{u'username': u'i80and', u'name': u'Andrew Aldridge', u'email': u'i80and@foxquill.com'}

Message: DOCS-3169: Improve $type documentation, factor out BSON type list.

Signed-off-by: Sam Kleinman <samk@10gen.com>
Branch: master
https://github.com/mongodb/docs/commit/57feb66ab92bf3c67b363556372c63b9f7c55d68

Generated at Thu Feb 08 07:45:08 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.