[DOCS-5883] Document "number" alias for $type Created: 21/Jul/15  Updated: 11/Jan/17  Resolved: 03/Dec/15

Status: Closed
Project: Documentation
Component/s: Server
Affects Version/s: None
Fix Version/s: 01112017-cleanup

Type: Task Priority: Major - P3
Reporter: David Storch Assignee: Ravind Kumar (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
documents SERVER-19243 Allow $type to support "number" as ty... Closed
Participants:
Days since reply: 8 years, 11 weeks ago

 Description   

SERVER-19243 added the ability to use the syntax

db.coll.find({<field>: {$type: "number"}});

This will match all documents for which <field> is any of the numerical BSON types (NumberInt, NumberLong, NumberDouble):

> db.coll.drop()
> db.coll.insert({_id: 1, num: NumberInt('123')})
> db.coll.insert({_id: 2, num: NumberLong('123')})
 
> db.coll.find({num: {$type: "number"}})
{ "_id" : 1, "num" : 123 }
{ "_id" : 2, "num" : NumberLong(123) }

This should be added to the $type documentation here: http://docs.mongodb.org/manual/reference/operator/query/type/



 Comments   
Comment by Githook User [ 02/Dec/15 ]

Author:

{u'username': u'rkumar-mongo', u'name': u'ravind', u'email': u'ravind.kumar@10gen.com'}

Message: DOCS-5883 : Add 'Number' alias option for $type

Round 2: CR changes

Round 1:

  • Added 'Number' Alias to type.txt
  • Minor formatting edits / cleanups

Signed-off-by: kay <kay.kim@10gen.com>
Branch: master
https://github.com/mongodb/docs/commit/92612cb334fc8aae86be5f1c93e5998e2ffad60f

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