NodeJS and Mongo - Unexpected behaviors when multiple users send requests simultaneously

前端 未结 2 954
自闭症患者
自闭症患者 2021-01-14 03:46

We\'ve been using NodeJS and mongo (via mongoose) to do a very simple save(). We have a model called \"highlights\" which contains an array of ObjectId s that reference \"re

2条回答
  •  囚心锁ツ
    2021-01-14 04:40

    To nest the model you could write the Schema like this

    const ResponseSchema = require('../where your schema file is')
    
    var highlightSchema = Schema({
      [...]
      , responses: [ResponseSchema]
      [...]
    });
    

提交回复
热议问题