Comments (10)
In the Swift API you can do it like this:
realm.objects(MyClass).filter("prop2='key'").setValue(14, forKey: "prop1")
from realm-js.
you guys are so fancy with your chaining!
I don't have the immediate need, but would do something like that in JS eventually.
from realm-js.
It feels pretty inefficient to be looping in javascript to set a bunch of rows. Our MySQL equivalent use case is UPDATE jobs SET state='inactive' WHERE id NOT IN(array)
from realm-js.
In the short term we plan to support more js array methods including foreach
and map
. This should allow you to update each item without having to explicitly loop through each item, although underneath the hood we will still have a loop at some level.
from realm-js.
Is there any reason that we can't just implement the setValue()
method in js as well?
from realm-js.
We could but this concept may be foreign to most js developers. We implemented setValue()
in swift as setting values by keyPath is built into cocoa and expected by cocoa developers. My understanding is that the analogous functionality in JS is forEach
and map
. Adding setValue()
would should be lower priority that these expected methods and wouldn't gain much as we would still have to loop through all elements (although we could avoid creating JS accessors).
from realm-js.
But it's not foreign to people that have been using sqlite/coredata in iOS that are now switching to React / Realm. Most engineers would assume it's significantly slower to do the iteration. That could be a big deal depending on the scale and they might be willing to deviate from common JS practices.
from realm-js.
Fair point. This is a feature that power users may expect and becomes much more important with larger data sets.
from realm-js.
to be clear, our set is not big enough for this to be a blocker, but just trying to help your success.
from realm-js.
Realm JS 2.0.0 introduced Realm.Results.update()
.
from realm-js.
Related Issues (20)
- Upgrade to Realm Core 14.5.0 HOT 1
- Random SIGSEGV error and crash on production HOT 2
- Error Realm initialization with sync enabled due to mismatch schema is not calling onError function HOT 9
- Version mismatch does not block sync HOT 5
- Run React Native integration tests in more configurations HOT 2
- Cannot index a property using TypeScript HOT 8
- Electron crash on exit (Segmentation fault, MacOS) HOT 5
- Upgrade to Realm Core 14.5.1 HOT 1
- Add ability to pass a configured Realm instance to RealmProvider HOT 2
- The binary file is not permitted. HOT 13
- TypeError: Cannot read property 'size' of undefined HOT 17
- Upgrade to Realm Core v14.5.2 HOT 1
- Cannot find module 'realm' from *** while using jest HOT 2
- Getting Error “Sync session became inactive” unhandled error HOT 5
- calling stream.return() on chrome 124 crashes browser HOT 19
- Required PrivacyInfo.xcprivacy - NSPrivacyAccessedAPICategoryFileTimestamp AND NSPrivacyAccessedAPICategoryDiskSpace HOT 16
- The "bundle install & & RCT_NEW_ARCH_ENABLED=1 bundle exec pod install" command results in the error "Could not find the Realm binary." HOT 12
- React Native Crash on compilation HOT 3
- [realm/react] investigating skipped tests HOT 2
- Enable and implement the tests for `App.updateBaseUrl()` HOT 1
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 realm-js.