These are chat archives for Automattic/mongoose

2nd
Aug 2016
Sandro
@manonthemoon42
Aug 02 2016 01:39
Hello !

I have this error showing :

Mongoose: mpromise (mongoose's default promise library) is deprecated

Tried to fix it doing like they said in the issue here : Automattic/mongoose#4291
Right before calling connect :

mongoose.Promise = global.Promise;

It didn't fix it.

Vlado Tesanovic
@vladotesanovic
Aug 02 2016 08:05
@manonthemoon42 Are you sure that you are using it in proper way? Seams ok
Vlado Tesanovic
@vladotesanovic
Aug 02 2016 08:12

Anyone using here Mongoose with TypeScript? I am having problem to define Type of mongoose.model<IPost>("Post", schema);

What i put now is : type PostModel = Model<IPost> & IPostModel;
https://github.com/vladotesanovic/typescript-mongoose-express/blob/master/server/models/post/model.ts#L37

But TypeScript compiler is complaining when i latter in code put his:
const post: PostModel = new Post();

with: Initializer type Model<IPost> is not assignable to variable type PostModel

clocked0ne
@clocked0ne
Aug 02 2016 11:51
@manonthemoon42 Make sure you are are only using the one connection, otherwise the error will be reported for any other connections opened elsewhere that have not had that set against them.
Aravind Suresh
@aaravinds_twitter
Aug 02 2016 18:49
hi can someone suggest me the best mongoose auto increment library
nikkwong
@nikkwong
Aug 02 2016 20:40
Can someone tell me why this won't work?
Model.aggregate(
   {'$filter': 
     {"input": "$_id",
     "as": "id",
     "cond": {$gte: ["$$id", mongoose.Types.ObjectId("57a0dc1ba62a6f01612f42a9").getTimestamp()]
    }
  });