Can't retrieve embedded object from a MongoDB document - MERN stack

I am using the MERN stack for my current project. So I am facing this problem:

Let’s say that I have the following document in MongoDB :

   name: "Tesla Inc.",
   category: "Automotive",
   contact: {
     state : {
       name: "Texas",
       city: "Austin", 
         address: {
          streetName: "Tesla Road",
          number: '1'

What I get as response after using findOne({ name : "Tesla"}) is :

 {_id: '637e4397f6723844191aa03d', name: 'Tesla', category: 
 'Automotive', contact: {…}} 

As you can see contact object is undefined

Follows my coding process

  1. This is my Express route for quering the database :
storeRoutes.route("/enterprise").get(function (req, res) {
  let db_connect = dbo.getDb("res");

  const query = { name : "Tesla"};
  .findOne(query,function (err, result) {
    if (err) throw err;

Result: After typing browser url http://localhost:5000/enterprise returns the expected value:

{"_id":"637e4397f6723844191aa03d","name":"Tesla","category":"Automotive","contact":{"state":{"name":"Texas","city":"Austin","address":{"streetName":"Tesla Road","number":"1"}}}}
  1. This a Retriever Data Function that returns the data object:
  function GetEnterprise() {
    const [store, setStore] = useState({
    useEffect(() => {
      async function fetchData() {
        const response = await fetch(`http://localhost:5000/enterprise`);
        if (!response.ok) {
          const message = `An error has occurred: ${response.statusText}`;
        const record = await response.json();
        if (!record) {
        //  window.alert(`Record with id ${id} not found`);
          window.alert(`Record with id  not found`);
    }, [1]); 
    console.log('tesla: ' + store); = store;
    let res_json = JSON.stringify(store);
    console.log('res_json :' + res_json);
    return store;

Before GetEnterprise() function returns store I have added these 4 lines of code for debugging:

 console.log('tesla: ' + store); = store;
 let res_json = JSON.stringify(store);
 console.log('res_json :' + res_json);

1st line logs [object Object] which is not that informative for what I am getting back as a response.
So I came up with 2nd line which enables to debug directly from the browser console.
After I type store my console logs:

{_id: '637e4397f6723844191aa03d', name: 'Tesla', category: 'Automotive', contact: {…}} 

So my contact object is missing(undefined).

Now fun fact is the 3rd and 4rd lines :

  let res_json = JSON.stringify(store);
  console.log('res_json :' + res_json);

My console logs the whole object as expected:

 {"_id":"637e4397f6723844191aa03d","name":"Tesla","category":"Automotive","contact":{"state":{"name":"Texas","city":"Austin","address":{"streetName":"Tesla Road","number":"1"}}}}

Which is really weird.
I guess it has something to do with the async and await functions. But I am not sure.
What am I doing wrong?
Any suggestions …?

I do not think your

I think that

is just the way console.log outputs complex object.

The fact that JSON.stringify prints it correctly as you wrote

confirms that it is not missing(undefined).

Wrong. Your object is not missing or undefined. If it was you would get an exception when you try to access it.

Use the contact object since it is not missing or undefined.

You are simply misunderstanding the meaning of the output

If it was really missing or undefined it would not even show up.

Please make a post as the solution for your other post.

You are right! “contact” is a complex object and “{…}” is the way complex objects are displayed on the console. Although, my problem still remains as I can’t get the embedded document. From example, in my app.js console.log('enterprise contact' +; prints app.js:210 Uncaught TypeError: Cannot read properties of undefined (reading 'state')

Rather than

try to output the top level object with
console.log('enterprise ’ + enterprise)