Value stores as null if it is not present, but it’s not a required field

Hi, I’m facing the same error as Mongodb Realm Sync GraphQL compatibility in Node js sdk. Is there any relevant solution to this?

My schema is:

        {
      "title": "content",
      "required": [
        "_id"
      ],
      "properties": {
        "__v": {
          "bsonType": "int"
        },
        "_id": {
          "bsonType": "objectId"
        },
        "ambiguous_publication": {
          "bsonType": "bool"
        },
        "ambiguous_publisher": {
          "bsonType": "bool"
        },
        "authors": {
          "bsonType": "array",
          "items": {
            "bsonType": "object",
            "properties": {
              "_id": {
                "bsonType": "objectId"
              },
              "ambiguous_author": {
                "bsonType": "bool"
              },
              "author": {
                "bsonType": "objectId"
              },
              "createdAt": {
                "bsonType": "date"
              },
              "updatedAt": {
                "bsonType": "date"
              }
            }
          }
        },
        "createdAt": {
          "bsonType": "date"
        },
        "description": {
          "bsonType": "string"
        },
        "html": {
          "bsonType": "string"
        },
        "language": {
          "bsonType": "object",
          "properties": {
            "_id": {
              "bsonType": "objectId"
            },
            "createdAt": {
              "bsonType": "date"
            },
            "display_name": {
              "bsonType": "string"
            },
            "language_id": {
              "bsonType": "objectId"
            },
            "lcid_String": {
              "bsonType": "string"
            },
            "name": {
              "bsonType": "string"
            },
            "updatedAt": {
              "bsonType": "date"
            }
          }
        },
        "main_image_url": {
          "bsonType": "string"
        },
        "origin_type": {
          "bsonType": "string"
        },
        "origin_url": {
          "bsonType": "array",
          "items": {
            "bsonType": "string"
          }
        },
        "pub_date": {
          "bsonType": "date"
        },
        "publication": {
          "bsonType": "objectId"
        },
        "publisher": {
          "bsonType": "objectId"
        },
        "redirect_url": {
          "bsonType": "string"
        },
        "sub_title": {
          "bsonType": "string"
        },
        "title": {
          "bsonType": "string"
        },
        "updatedAt": {
          "bsonType": "date"
        },
        "url": {
          "bsonType": "string"
        },
        "_partition_key": {
          "bsonType": "string"
        }
      }
    }

I’m facing with publisher it is stores as null if it is not present, but it’s not a required field. So, Please provide a solution to this.

1 Like