# \[Missing action\] While creating a document containing an array, I can't remove an item from it (at creation time)

**URL:** <https://community.forestadmin.com/t/missing-action-while-creating-a-document-containing-an-array-i-cant-remove-an-item-from-it-at-creation-time/1947>\
**Category:** Help me!\
**Created:** [February 25, 2021, 10:01pm UTC](https://community.forestadmin.com/t/missing-action-while-creating-a-document-containing-an-array-i-cant-remove-an-item-from-it-at-creation-time/1947 "2021-02-25T22:01:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emixam23](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/emixam23/32/1350_2.png) [@Emixam23](https://community.forestadmin.com/u/Emixam23)\
**Post date:** [February 25, 2021, 10:01pm UTC](https://community.forestadmin.com/t/missing-action-while-creating-a-document-containing-an-array-i-cant-remove-an-item-from-it-at-creation-time/1947/1 "2021-02-25T22:01:06Z")

</div>

Hey,

I might have found a bug or a missing action in Forest Admin 🙂

The issue is quite easy to reproduce, create these two models:

**item.ts**

```javascript
import { Schema, Document, model} from 'mongoose';
import * as notes, {INotes} from './notes.ts';

interface IItem extends Document {
  name: string,  
  notes: [INote],
  // ...
}

const schema = new Schema({
  'name': String
  'notes': [notes]
  // ...
}, {
  timestamps: false,
});

export default model<IItem>('items', schema, 'Items');

```

So, note is basically a simple model which isn’t a collection itself and used only as nested document schema.

**note.ts**

```javascript
import { Schema, Document, model, Types} from 'mongoose';

export interface INote extends Document {
  title: string,
  message: string,
  // ...
}

const schema = new Schema({
  "title": String,
  "message": String,
  // ...
}, {
  timestamps: false,
});

export default model<INote>('notes', schema);

```

Now that you have your collection **items** ready, let’s create an **Item** by clicking on the top/right on [Add] action:

![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/d/d64d4cf8577651d4a9d933f8ea1db5b7e77ddef0.png)

Once you clicked on it, the screen gets updated and you can edit each field of your new document. The part that we want to focus on will be on the left, within the **Related data** section.

![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/d/db25e7a4987a8b6634638ae804e58bf0acf0b43e.png)

Now I let you create some new **Notes** from the related data section.

Let’s say you created more than **ONE** note, I let you try to remove one 🙂

**As you can see… you can’t remove any 🙂 you will first need to create the item (or validate the creation of your Item) then edit it to be able to remove one or more notes from the ones you just created 🙂**

Hope it helps 🙂 I am quiete sure it’s a very small bug because the “Delete” action (mono or bulk) is present from the update (and it’s almost the same screen/UI)

Best,

Max

---

<div class="post-metadata">

**Author:** ![anon94532230](https://avatars.discourse-cdn.com/v4/letter/a/a587f6/32.png) [@anon94532230](https://community.forestadmin.com/u/anon94532230)\
**Post date:** [February 26, 2021, 9:08am UTC](https://community.forestadmin.com/t/missing-action-while-creating-a-document-containing-an-array-i-cant-remove-an-item-from-it-at-creation-time/1947/2 "2021-02-26T09:08:19Z")

</div>

Hi again @Emixam23, let me look into this…  
Could you share a video of what you are trying to do ?

---

<div class="post-metadata">

**Author:** ![Emixam23](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/emixam23/32/1350_2.png) [@Emixam23](https://community.forestadmin.com/u/Emixam23)\
**Post date:** [March 2, 2021, 9:26pm UTC](https://community.forestadmin.com/t/missing-action-while-creating-a-document-containing-an-array-i-cant-remove-an-item-from-it-at-creation-time/1947/3 "2021-03-02T21:26:19Z")

</div>

Hello,

Sorry again for the late reply. Hmm I can’t really share a video of my work but I am open to show you through a “share screen conversation” if you agree 🙂 I don’t think it would take more than 5mins, it’s as easy as I wrote to reproduce.

Also I am french so it should be really easy to communicate around the subject if required.

Best,

Max

---

<div class="post-metadata">

**Author:** ![anon39848301](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@anon39848301](https://community.forestadmin.com/u/anon39848301)\
**Post date:** [March 3, 2021, 9:09am UTC](https://community.forestadmin.com/t/missing-action-while-creating-a-document-containing-an-array-i-cant-remove-an-item-from-it-at-creation-time/1947/4 "2021-03-03T09:09:06Z")

</div>

Hello @Emixam23 👋,

Just to be sure, this only happens when creating new records right?  
I just did a quick test on my end, but I’m able to remove related data while creating a new record. Is this the behavior you are expecting but not having ?

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/2/2fd99550a1ebc5876879e872659d4e875e703383.png)

> Sorry again for the late reply. Hmm I can’t really share a video of my work but I am open to show you through a “share screen conversation” if you agree

We tend to prefer discussion here over a call when possible, so other users can benefit from these thread 🙂

Let me know if I got this right or if I’m missing your point 🙏

---

<div class="post-metadata">

**Author:** ![Emixam23](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/emixam23/32/1350_2.png) [@Emixam23](https://community.forestadmin.com/u/Emixam23)\
**Post date:** [March 3, 2021, 11:07pm UTC](https://community.forestadmin.com/t/missing-action-while-creating-a-document-containing-an-array-i-cant-remove-an-item-from-it-at-creation-time/1947/5 "2021-03-03T23:07:42Z")

</div>

Hey 🙂

Yes I get you, it’s ok 🙂  
Alright wow that’s weird because, it works partially on my end…

I have a list of foreign IDs where, each time I add an ID (at create time), I can’t select/remove  
However, when having the situation I gave you (with nested documents with in an array), I can only create new item to add to this array… Only when I am done creating, while editing, I can select/remove…

Did you recreate exactly the behavior I gave you above? I really don’t get why it works for you tbh 😕

Thanks,

Max

---

<div class="post-metadata">

**Author:** ![Arnaud\_Moncel](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/arnaud_moncel/32/24_2.png) [@Arnaud\_Moncel](https://community.forestadmin.com/u/Arnaud_Moncel)\
**Post date:** [March 5, 2021, 9:32am UTC](https://community.forestadmin.com/t/missing-action-while-creating-a-document-containing-an-array-i-cant-remove-an-item-from-it-at-creation-time/1947/6 "2021-03-05T09:32:32Z")

</div>

Hi @Emixam23 👋 unfortunately is not possible today. I “reproduce” your behavior and i deep dive into the code and it’s not a bug. I will push your request in our product board thank you for your feedback.
