question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Return value from realm.write

See original GitHub issue

Allow returning value from realm.write

E.g.

const user = realm.write(() => {
  return realm.create('User', {})
})

If you accept this feature request, I can provide PR.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
nirinchevcommented, Apr 23, 2020

@kneth seeing your comment only now - I think realm.write should just return whatever the callback returned. So if you did:

let foobar = realm.write(() => {
  // create objects, update them, etc.
  return { "foo": "bar" }
});

foobar.foo == "bar";
1reaction
nirinchevcommented, Feb 4, 2019

I think it makes sense and doesn’t sound like a breaking change. We’d be happy to review a PR for it. cc @kraenhansen @cmelchior

Read more comments on GitHub >

github_iconTop Results From Across the Web

Read & Write Data - Node.js SDK — Realm - MongoDB
Query operations return a collection of Realm objects that match the query as ... A filter selects a subset of results based on...
Read more >
Check realm create function returning object new or updated
The code checks if the object with a given primary key exists; if no then create a new object with the default value...
Read more >
Getting started with Realm for React Native | by mbvissers.eth
It creates a View with three texts each containing a value of the books ... You can see that within a realm.write function...
Read more >
Realm Xamarin 0.75.0
Realm Xamarin enables you to efficiently write your app's model layer in a safe, ... property public string Email { get { return...
Read more >
The things I've learned using Realm | by Gabor Varadi - Medium
When we call an accessor on a RealmResults , we actually receive a proxy instance, that can read from and write to the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found