Comments (5)
Because you are doing it wrong. collection.save()
method is supposed to use internally there is no save()
method for public use. There is save method in instance level. There is collection.create()
if you want to use.
Check documentation for Adding data
Also Adding data using Managaer
from fireo.
Hi @AxeemHaider ,
sorry, I have did typo and fix it above.
so on add new , I did use create
method not save
.
current issue tested with fireo==1.3.8
from fireo.
Why you want to save
after creating document you don't need to save
it.
The reason why it is not saving is as mention in error message itself.
ReferenceTypeError: Invalid reference type. Field "user" required value type "User", but got "ReferenceDocLoader
Because you set auto_load=False
that's why when you try to save it error come up invalid type because it require User
type. set auto_load=True
so it load the User
document or load it before saving it.
activity = UserActivity.collection.create(user=user)
activity.user = activity.user.get()
activity.save()
from fireo.
About the creating document and save it, this is just sample to reproduce the issue.
class ReferenceTestModel):
Ref1 = ReferenceField(Amodel, auto_load=False)
Ref2= ReferenceField(XModel, auto_load=False)
Ref3= ReferenceField(YModel, auto_load=False)
text = TextField(required=True)
hmm so, if I have above model instance and want to change only one field: text
.
Did you mean, need to load all available reference fields
for save method to work ?
from fireo.
You have to use update()
method. Check Documentation for Update
from fireo.
Related Issues (20)
- How to add field during runtime? HOT 1
- FactoryBoy factories are coming soon! HOT 2
- FireO in FastAPI-filters
- Bug: QuerySet actions should not modify it's self but create a copy HOT 1
- A way to use "id" instead of "key" in Manager HOT 1
- 2.0.0 migration problem from 1.7.0 HOT 3
- version 2.0.0 error with ListUnion/ListRemove HOT 5
- Model to have a ReferenceField to itself HOT 1
- Cursor and Ordering HOT 1
- Fix delete all documents in collection documentation
- Running example script fails HOT 1
- List Field wont update / Save HOT 1
- ReferenceFields support for TypedModel HOT 2
- Default values not being set HOT 2
- FireO 2.2.1 issues with pylance and co HOT 2
- UserWarning: Detected filter using positional arguments. Prefer using the 'filter' keyword argument instead. HOT 1
- Anyway to activate function after create Model? HOT 2
- TypedModel reference fields don't work HOT 2
- Best way to get an instance id on TypedModels, without saving first
- [Question] How to test code that depends on Fireo in pytests? 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 fireo.