-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't use modifiers in update method after upgrade to 2.6.1 #59
Comments
Fixed in v2.6.1 |
Thanks! |
use nedb you can not do this yourService.update(id, {
$inc: {
good: 1
},
createdAt:new Date()
}) property name start with $ and property name not start with $ Can not appear at the same time so when you set a hooks like this exports.before = {
all: [],
find: [],
get: [],
create: [hooks.setCreatedAt(), hooks.setUpdatedAt()],
update: [hooks.setUpdatedAt()],
patch: [],
remove: []
}; and some where just call the below code with the before hook above will always exception(You cannot mix modifiers and normal fields) yourService.update(id, {
$inc: {
good: 1
}
}) if you want add timestamp . just remove the hook but set timestampData to true const db = new NeDB({
filename: path.join(app.get('nedb'), 'posts.db'),
autoload: true,
timestampData: true
}); I think it's a good idea to put these into a document |
@bugss absolutely. Would you mind making a PR to the auk docs? It's this page: https://docs.feathersjs.com/v/auk/api/databases/nedb.html |
feathersjs-ecosystem/docs#457 |
I don't know if that could help you to solve the issue and pull a new request. In nedb, if you do this : db.collection.update({ _id: 'MYID' }, { key: 'value' , $push: { key: 'value' } }, { returnUpdatedDocs: true, multi: false }, (err, num, doc) => {
// Error: You cannot mix modifiers and normal fields
}) But, if you use 2 modifiers db.collection.update({ _id: 'MYID' }, { $set: { key: 'value' }, $push: { key: 'value' } }, { returnUpdatedDocs: true, multi: false }, (err, num, doc) => {
// will be ok
}) The trick is to use |
Steps to reproduce
Use update method in nedb service with modifiers (like
$push
,$pull
, etc.).Produces error when using [email protected].
System configuration
Module versions: 2.6.1
NodeJS version: 6.9.5
Operating System: macOS 10.12 / docker node:6 container
Module Loader: [email protected]
Working normally @
2.6.0
.Somehow related to this: v2.6.0...v2.6.1#diff-1fdf421c05c1140f6d71444ea2b27638
The text was updated successfully, but these errors were encountered: