Mongodb aggregate arguments to $lookup must be strings

后端 未结 2 1269
暗喜
暗喜 2021-01-17 16:04
        db.absences.insert([
           { \"_id\" : 1, \"student\" : \"Ann Aardvark\", sickdays: [ new Date (\"2018-05-01\"),new Date (\"2018-08-23\") ] },
                  


        
2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-17 16:07

    Because you are trying to use the $lookup features (syntax) from MongoDB v3.6 on MongoDB v3.4

    The MongoDB v3.4 $lookup syntax:

    {
       $lookup:
         {
           from: ,
           localField: ,
           foreignField: ,
           as: 
         }
    }
    

    The MongoDB v3.6 $lookup syntax:

    {
       $lookup:
         {
           from: ,
           let: { : , …, :  },
           pipeline: [  ],
           as: 
         }
    }
    

    https://docs.mongodb.com/manual/reference/operator/aggregation/lookup/

提交回复
热议问题