0

I have the following document:

 {
      "_id": 55d91b345ad7478c0c1a5c51,
      "name": "pasa la plaza",
      "testCases": [
        {
          "stateTestCase": "deberia jalar yo creo",
          "_id": "55d91b5a5ad7478c0c1a5c52"
        }
      ]
    }
  }

In the position of the test case [0] I have a testcase without the "startDate" field. If I update testcase [0] should create "startDate" field with the current system's date, :

"testCases": [
            {
              "stateTestCase": "field recently updated, will be created the startDate",
              "_id": "55d91b5a5ad7478c0c1a5c52",
              "startDate": "2015-08-23T04:00:00.000Z"
            }
          ]

but if I were to update the testcase[0] should only update the "stateTestCase" field and not the "startDate" field that can be updated only once.

"testCases": [
                {
                  "stateTestCase": "field updated again, but not startDate",
                  "_id": "55d91b5a5ad7478c0c1a5c52",
                  "startDate": "2015-08-23T04:00:00.000Z"
                }
              ]

Is it possible to do that in mongoose? If so then how?

Stack Player
  • 1,470
  • 2
  • 18
  • 32
user2994005
  • 57
  • 1
  • 9

0 Answers0