Hi I have been asked to identify what is the value it holds for an object field named usertype. The thing is it is easier to identify it using compass schema view. Since I had continuous connection issue I m learning and cleared labs using mongo shell. I couldn’t find command to read the field details. I could only read to know that it is a object type field. Kindly help as I need to complete my exam
I would recommend you to use Compass for this purpose. If you are facing connection issues then you can import the datasets used in the labs into a locally running mongod instance and connect through Compass. For doing this, please refer this post.
In mongo shell you can use two operators to check the type of fields :
typeof operator returns a more generic object type value.
instanceof operator returns a boolean to test if a value is an instance of some type. For example :
This would return true if the type of the
my_field_name is Array.
Hope it helps!
Please feel free to get back to us if you have any other query.
Curriculum Services Engineer