Skip to content

Instantly share code, notes, and snippets.

@asya999
Created July 15, 2015 19:40
Show Gist options
  • Save asya999/ecafc87a387b0030c129 to your computer and use it in GitHub Desktop.
Save asya999/ecafc87a387b0030c129 to your computer and use it in GitHub Desktop.
> db.mixedTypes.aggregate({$project:{f1:1,typeF1:getTypes("$f1")}})
{ "_id" : ObjectId("55a5761b377e8e01062a12ab"), "f1" : 1, "typeF1" : "Number" }
{ "_id" : ObjectId("55a57622377e8e01062a12ac"), "f1" : "1.000", "typeF1" : "String" }
{ "_id" : ObjectId("55a57630377e8e01062a12ad"), "f1" : { "field" : 1 }, "typeF1" : "Subdocument" }
{ "_id" : ObjectId("55a5763d377e8e01062a12af"), "f1" : ObjectId("55a5763d377e8e01062a12ae"), "typeF1" : "ObjectId" }
{ "_id" : ObjectId("55a57644377e8e01062a12b0"), "f1" : true, "typeF1" : "True" }
{ "_id" : ObjectId("55a57647377e8e01062a12b1"), "f1" : false, "typeF1" : "False" }
{ "_id" : ObjectId("55a57651377e8e01062a12b2"), "f1" : ISODate("2015-07-14T20:51:29.324Z"), "typeF1" : "ISODate" }
{ "_id" : ObjectId("55a57659377e8e01062a12b3"), "f1" : null, "typeF1" : "Null" }
{ "_id" : ObjectId("55a57675377e8e01062a12b4"), "f1" : 1, "typeF1" : "Number" }
{ "_id" : ObjectId("55a57682377e8e01062a12b5"), "f1" : NumberLong(1), "typeF1" : "Number" }
{ "_id" : ObjectId("55a576c8377e8e01062a12b6"), "f1" : Timestamp(1436907208, 1), "typeF1" : "Timestamp" }
{ "_id" : ObjectId("55a577f6377e8e01062a12b7"), "f1" : [ "1" ], "typeF1" : "Array" }
{ "_id" : ObjectId("55a577fc377e8e01062a12b8"), "f1" : [ { "field" : "1" } ], "typeF1" : "Array" }
{ "_id" : ObjectId("55a5868a377e8e01062a12b9"), "f1" : "", "typeF1" : "String" }
{ "_id" : ObjectId("55a6a9ba149ba0020295709d"), "f1" : BinData(3,""), "typeF1" : "BinData" }
{ "_id" : ObjectId("55a6b19f6a29c18c1336e50e"), "f1" : /abc/i, "typeF1" : "Regex" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment