title: How to pass an ObjectId into a POST request?
body: <p>I am trying to make a <code>One-To-Many</code> relationship between two tables(Group and Movement tables) using node js (Express) and mongo DB. I already have a <code>group Id</code> coming from the Group table on my side, my question is, how can I save a movement( <strong>see point 3</strong> ) with that <code>group Id</code> I have. I tried passing <code>groupId: req.body.group._id</code> and 
   <code>groupId: req.body.group</code> but I am never able to populate that variable</p>
  
  <p>This are the two entities I've created:</p>
  
  <p><strong>1) GROUP ENTITY</strong></p>
  
  <pre><code>const mongoose = require("mongoose")
  
  const GroupSchema = mongoose.Schema({
      name: {
          type: String,
          required: true
      },
      limit: {
          type: String,
          required: true
      },
  
      date: {
          type: Date,
          default: Date.now
      },
      movement: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Movement' }],
      user: { type: mongoose.Schema.Types.ObjectId, ref: 'User' }
  })
  
  module.exports = mongoose.model("Group", GroupSchema)
  </code></pre>
  
  <p><strong>2) MOVEMENT ENTITY</strong></p>
  
  <pre><code>const mongoose = require("mongoose")
  
  const MovementSchema = mongoose.Schema({
      description: {
          type: String,
          required: true
      },
      value: {
          type: String,
          required: true
      },
      date: {
          type: Date,
          default: Date.now
      },
      group: { type: mongoose.Schema.Types.ObjectId, ref: 'Group' }
  })
  
  module.exports = mongoose.model("Movement", MovementSchema)
  </code></pre>
  
  <p>This is my movement router where I make the endpoints (<strong>Actual problem is here</strong>)</p>
  
  <p><strong>3) MovementRoute</strong></p>
  
  <pre><code>const router = require('express').Router();
  const verify = require('./verifyToken');
  const User = require('../model/User');
  const Group = require('../model/Group');
  const Movement = require('../model/Movement');
  
  // Create Movement
  router.post('/', verify, async (req, res) =&gt; {
      const post = new Movement({
          description: req.body.description,
          value: req.body.value,
          groupId: req.body.group._id //**tried this**
      });
  
      try {
          const savedMovement = await post.save()
          res.status(200).send(res.json({ data: savedMovement }));
      } catch (error) {
          res.status(400).send(res.json({ message: error }));
      }
  });
  
  module.exports = router;
  </code></pre>
  
  <p><strong>Request sent</strong></p>
  
  <pre><code>{
      "description":"group1",
      "value":"233",
      "group":"5e506f3c56233d08f79bc8f3"
  }
  </code></pre>