# Is it possible to have a object in typeDefs without having to declare it explicitly

**URL:** <https://community.apollographql.com/t/is-it-possible-to-have-a-object-in-typedefs-without-having-to-declare-it-explicitly/6108>\
**Category:** Server\
**Tags:** server\
**Created:** [April 8, 2023, 11:06pm UTC](https://community.apollographql.com/t/is-it-possible-to-have-a-object-in-typedefs-without-having-to-declare-it-explicitly/6108 "2023-04-08T23:06:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hernans](https://avatars.discourse-cdn.com/v4/letter/h/2acd7d/32.png) [@Hernans](https://community.apollographql.com/u/Hernans)\
**Post date:** [April 8, 2023, 11:06pm UTC](https://community.apollographql.com/t/is-it-possible-to-have-a-object-in-typedefs-without-having-to-declare-it-explicitly/6108/1 "2023-04-08T23:06:11Z")

</div>

hi there im new to apollo server, im doing the backend of a cooking site, the thing is that in my mongo schema i got this code

```auto
const recipeSchema = new Schema({
 title: {
        type: String,
        required: true
    },
    ingredients: {
        type: Object,
        required: true,
    },
    preparation: {
        type: String,
        required: true
    },
    author: {
        type: Object,
        required: true
    },
    thumbnail: String
})
//of course i exported the model and schema correctly

```

and the question is, in typeDefs can i have ingredients as an object without having to declare it e.g

```auto
type Receta{
      id:ID!
      title:String!
  /* i don't know how many ingredients the recipe will have so i don't want to do
ingredients:[Ingredient!]! then type Ingredient{i1:String i2:String,etc} beacuse
as i stated before i don't know how many ingredients a recipe will have, and i want to
have ingredients as an object, so then i can map it with react and have and output like
cheese:"200gr",pasta:"400gr",etc
*/
      ingredients:[!]!

```

its that posible, or can i solve this problem

---

<div class="post-metadata">

**Author:** ![Justin\_Gonzalez](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/justin_gonzalez/32/5359_2.png) [@Justin\_Gonzalez](https://community.apollographql.com/u/Justin_Gonzalez)\
**Post date:** [February 6, 2025, 8:49pm UTC](https://community.apollographql.com/t/is-it-possible-to-have-a-object-in-typedefs-without-having-to-declare-it-explicitly/6108/2 "2025-02-06T20:49:09Z")

</div>


