Comments (7)
There isn't, for now! What's your use case?
from mongo-thingy.
There isn't, for now! What's your use case?
I want to update the data from the database every 60 secs
from mongo-thingy.
For a single object or a cursor?
Why not using find
or find_one
again, every 60 seconds?
from mongo-thingy.
"Refreshing" an object does not involve the construction of a new one, and may potentially be limited to a subset (projection) of fields to be refreshed. Example. (The "TODO" there relates to handling nested/"complex" objects better and the "top level" current limitation.)
Notably, a "refreshed" object will share an identity. (Calling .reload()
on one handle reloads the object in-place.)
some_record is some_record.reload()
Whereas the same is not true of multiply-queried documents. Querying again will potentially leave a hanging reference to the old version of the object. (Edit to add: a possible memory leak.)
# With a single record present...
SomeDocument.find_one() is not SomeDocument.find_one()
This seems to be the case, here, as well, unless Thingy is doing some fairly deep magic behind-the-scenes to deduplicate and "cache" multiple instances of the underlying data. Something I strongly dislike other DAO engines doing, as it can lead to problems, which can, ironically, involve a greater need for a reload
method.
I want to update the data from the database every 60 secs
@Dewsworld This is referred to as "polling", and is the worst¹ solution to periodic or intermittent data processing. Have you examined Change Streams to pivot to realtime / event-based processing? (I.e. have your application do something when new data comes in, versus asking periodically if there's new data?)
¹ Though sometimes only viable solution. Regardless, it should always remain the solution of last resort.
from mongo-thingy.
I get the identity argument, but I still don't see a use case for a reload
method. On the opposite, I see a lot of value in supporting change streams, yes!
from mongo-thingy.
I apologize for distracting you from a 15 line fix with a potentially multi-hundred-line one. Practicality beats purity, but I will gladly accept a differentiating feature between your solution and mine. Change streams and reloading are distinct, and independently useful. The suggestion was for the developer asking the question initially as an avenue of investigation superior to polling, not that change streams would be a solution to reloading.
from mongo-thingy.
Alright, let's close this issue for now, we're all loosing our time here.
from mongo-thingy.
Related Issues (20)
- How to specify the collection name of mongodb HOT 2
- PyMongo 3.6.0 support
- Test against all supported versions of dependencies, not just one HOT 1
- Support other back-ends than PyMongo HOT 4
- Github corner
- Use alabaster Sphinx theme
- Implement Cursor.delete()
- Should we drop PyMongo<3.5 support? HOT 1
- Replace deprecated .insert by .insert_one HOT 1
- mongo_thingy doesn't create indexes HOT 3
- [Feature] Support Transactions HOT 2
- JSON serialization is failing for Thingy classes. HOT 2
- Convert ObjectId to string id for all the view HOT 2
- Remove six
- Use Pydantic for the views!
- Add type hints and have the CI run Mypy
- Improve the documentation
- Connect mongo-thingy to montyDB HOT 6
- Switch to mkdocs 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 mongo-thingy.