camomile-project / camomile-server

Collaborative annotation of multimedia documents
http://camomile-project.github.io/
MIT License
12 stars 4 forks source link

mongoose 4.x still uses $pushAll while it is deprecated in latest mongodb #85

Open hbredin opened 6 years ago

hbredin commented 6 years ago

cc @francoisromain

https://github.com/Automattic/mongoose/issues/5870 https://github.com/Automattic/mongoose/issues/4455

Workaround:

set the usePushEach option in all schemas with arrays

new Schema(obj, { usePushEach: true });
hbredin commented 6 years ago

cc @francoisromain

Can you try latest version in develop using docker-compose ... up --build -d?

francoisromain commented 6 years ago

Downgrading to mongodb 3.5 (db version v3.5.13) does not fix the problem.

v.3.4 fixes it.

hbredin commented 6 years ago

The latest version of camomile-server in develop branch should work with 3.6 as well...

francoisromain commented 6 years ago

ah ok I try this one

francoisromain commented 6 years ago

The last version in develop does not start. It makes this error:

const MongoClient = require('mongodb')
SyntaxError: Use of const in strict mode.

If you want to use es6, you should use at least node 4.

lakshmankashyap commented 6 years ago

thanks for solution

rivers-lis commented 6 years ago

А вот так можно const mongoose = require ('mongoose') const Схема = mongoose.Schema

const UserSchema = new Schema ({ telegramId: { type: Number, required: true },

films: { type: [String], default: [], новая схема ({}, {usePushEach: true}) } })

mongoose.model ('users', UserSchema)