Comments (5)
It's not there yet but it's in the plans :)
from odmantic.
Yes, the beginning of an implementation has been done in #1 .
But in the meantime, after some thoughts I ended up thinking that it would be better to use mongo db views to that end.
The usage with odmantic would be something like this:
class Rectangle(Model):
length: int
width: int
LengthView = createView(Rectangle, (Rectangle.length,))
# LengthView is a View object derived from pydantic; containing only the length field
rects = await engine.find(LengthView, Rectangle.width > 10)
On top of this, since we are using mongodb view, it would be as well possible to do something like this:
class RectangleAreaView(View, model=Rectangle):
area = Rectangle.length * Rectangle.width
This would create a View containing a field computed (db side) from some other of its fields.
from odmantic.
Thank you so much
from odmantic.
Sorry, I don't get it!! where is the createView
function? how do I use it?
from odmantic.
Hello, any updates about this issue? This functionality is very promising I think
from odmantic.
Related Issues (20)
- Preserve document fields ordering HOT 1
- Time Series support
- [Feature]: Add support for mixing models.
- ValueError: 'Config.use_enum_values' is not supported
- Cannot support motor time zone problem HOT 2
- Can't change a field in a copied embedded model that's part of a collection #228
- When the time is inserted into the database HOT 2
- Getting OperationFailure error when trying to find using the $near operator HOT 1
- Abstract models HOT 1
- is_type_mutable returns true for Literal types
- `database` argument for `Engine`s defaulted to `"test"` is unexpected
- Union of embedded models regression
- Exclude a field from serialization and saving into database
- Embedded Model Exclude None Not Functioning HOT 1
- Support native validator
- Using the union operator in model breaks HOT 1
- FastAPI schema can not show the fields in parent odmantic.Model class
- Add support for Pydantic V2 HOT 13
- Odmantic model names in openapi.json from FastAPI have __pydantic_model__ suffix
- ζδΉζεΊ
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 odmantic.