Comments (5)
Hi,
Which version of mongoose do you use?
from casl.
Tested with mongoose 4.11.5:
const m = require('mongoose')
const { AbilityBuilder, mongoosePlugin } = require('casl')
const ability = AbilityBuilder.define(can => {
can('manage', 'User', { email: '[email protected]' })
})
m.plugin(mongoosePlugin)
m.connect('localhost/misto')
const User = m.model('User', m.Schema({
email: String,
firstName: String
}))
User.accessibleBy(ability).findOneAndUpdate({ _id: "5989e0fb66e42d6cfa46130c" }, { firstName: 'test' }, { new: true }, (err, doc) => {
console.log(doc)
})
Everything works as exepcted
from casl.
Hey, I use
- mongoose 4.11.14
- casl 1.03
- mongoose-query 0.5.1
Thank you very much for your help! :)
from casl.
The same example works as expected with this deps:
sergii@sergii:~/projects/test$ npm ls mongoose casl
/home/sergii/projects/test
├── [email protected]
└── [email protected]
Could you please create a small example which reproduces this error?
from casl.
@Tasades I am going to close this as something that cannot be reproduced.
If you can provide a sample application that reproduces the issue, I can look into why it is occurring for you and perhaps suggest a fix for your code.
Thanks for using casl!
from casl.
Related Issues (20)
- question: using accessibleBy(ability) in prisma create query HOT 1
- [prisma] Support for Prisma V5 HOT 9
- accessibleBy does not throw an error as expected when using createPrismaAbility HOT 3
- $ability in component template is not updated after I update it in a mixin HOT 4
- 📖 Update docs for TypeScript in Vue 3 using `createMongoAbility` HOT 1
- Overriding via provide in a plugin causes strange behavior in templates HOT 19
- Subjects and Scopes (I need help) HOT 1
- CASL HOT 2
- Have to use @ts-ignore while defining abilities, is something broken? HOT 1
- Missing $or operator HOT 1
- Implementing CASL on Front-End and Backend Use Case HOT 2
- Condition using $exists doesn't behave as expected HOT 3
- Prisma how to run other queries as findMany HOT 4
- @casl/angular AblePipe and AblePurePipe typing not working in Angular template HOT 2
- @casl/angular able and ablePure pipes are not working as exptected HOT 2
- Compatibility with Angular 17
- How to use accessibleFieldsBy without Mongoose (with basic Mondodb driver) HOT 3
- Add Support for Mongoose v8 in @casl/mongoose HOT 3
- @casl/[email protected] npm package is missing content HOT 3
- Error: Hydration failed because the initial UI does not match what was rendered on the server. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from casl.