I'm using MongoDB and I need to find out what data type a particular field in a document has.  Is there a way to see the underlying data type of an existing document?  Example: I need to know the difference in the data types between the two dates seen in the screenshot I have provided.  Is one a String and the other Date?

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

I'm using MongoDB and I need to find out what data type a particular field in a document has.  Is there a way to see the underlying data type of an existing document? 

Example:

I need to know the difference in the data types between the two dates seen in the screenshot I have provided.  Is one a String and the other Date?

> db.inspections.find({"business_name":"AUSTIN 2012"}).pretty()
{
"_id" : 0bjectId("56d61035a378eccde8a971c3"),
"id" : "6658-2016-ENFO",
"certificate number" : 9327364,
"business_name" : "AUSTIN 2012",
"date" : "Jan 22 2016",
"result" : "Out of Business
"sector" : "Grocery-Retail - 808",
"address" : {
"city" : "NEW YORK",
"zip" : 10016,
"street" : "PARK AVE",
"number" : 10
}
> db.inspections.find({"business_name":"ACME Explosives"}).pretty()
{
"_id" : ObjectId("6278ca2fdb5f005de024d4db"),
"id" : "20032-2020-ACME",
"certificate_number" : 9998888,
"business_name" : "ACME Explosives",
"data" : IS0Date("2022- 05 -09T08:00:47.929Z"),E
"result" : "Business Padlocked",
"sector" : "Explosive Retail Dealer - 999",
"address" : {
"number" : 1721,
"street" : "Boom Road",
"city" : "BRONX",
"zip" : 10463
}
}
Transcribed Image Text:> db.inspections.find({"business_name":"AUSTIN 2012"}).pretty() { "_id" : 0bjectId("56d61035a378eccde8a971c3"), "id" : "6658-2016-ENFO", "certificate number" : 9327364, "business_name" : "AUSTIN 2012", "date" : "Jan 22 2016", "result" : "Out of Business "sector" : "Grocery-Retail - 808", "address" : { "city" : "NEW YORK", "zip" : 10016, "street" : "PARK AVE", "number" : 10 } > db.inspections.find({"business_name":"ACME Explosives"}).pretty() { "_id" : ObjectId("6278ca2fdb5f005de024d4db"), "id" : "20032-2020-ACME", "certificate_number" : 9998888, "business_name" : "ACME Explosives", "data" : IS0Date("2022- 05 -09T08:00:47.929Z"),E "result" : "Business Padlocked", "sector" : "Explosive Retail Dealer - 999", "address" : { "number" : 1721, "street" : "Boom Road", "city" : "BRONX", "zip" : 10463 } }
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY