Egg: 请教正确使用mongoose.Types.ObjectId方式

Created on 28 Apr 2018  ·  3Comments  ·  Source: eggjs/egg

请教正确使用mongoose.Types.ObjectId方式

on Mac 必须这么用,否则报错:

...
myFavorite = myFavorite.map(item => app.__mongoose.Types.ObjectId(item))
...

on Ubuntu 16.04:

...
myFavorite = myFavorite.map(item => app.mongoose.Types.ObjectId(item))
...
  • Node Version: 8.9
  • Egg Version:
  • Plugin Name:
  • Plugin Version:
  • Platform: Mac Ubuntu 16
  • Mini Showcase Repository:

Most helpful comment

应该是你mac和ubuntu上的egg-mongoose的版本不同,具体的看下这个库最近几个版本的提交日志就明白了。

All 3 comments

Translation of this issue:


ask to use mongoose.Types.ObjectId correctly

Ask correct use mongoose.Types.ObjectId way

On Mac must be used like this, or error:

...
myFavorite = myFavorite.map(item => app.__mongoose.Types.ObjectId(item))
...

On Ubuntu 16.04:

...
myFavorite = myFavorite.map(item => app.mongoose.Types.ObjectId(item))
...
  • Node Version: 8.9
  • Egg Version:
  • Plugin Name:
  • Plugin Version:
  • Platform: Mac Ubuntu 16
  • Mini Showcase Repository:

应该是你mac和ubuntu上的egg-mongoose的版本不同,具体的看下这个库最近几个版本的提交日志就明白了。

@StephenSeraph 谢谢指导,发现是mac上的版本太低。

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Leungkingman picture Leungkingman  ·  3Comments

lvgg3271 picture lvgg3271  ·  3Comments

Ailein picture Ailein  ·  3Comments

wujianling picture wujianling  ·  3Comments

ycvcb123 picture ycvcb123  ·  3Comments