Redux + DDP , no minimongo

Hey sorry I don’t think I’ll have time to investigate this soon.

One of the details that also hindered me from moving forward on the optimistic updates was the id generation of the document when you insert. In minimongo, when you insert, the id that is generated on the client is also the same one on the server. But because we’re using Redux to simulate an insert, we have to generate the id manually and I don’t know if it’ll be the same on the server, unless you explicitly pass it to the server. I haven’t investigated this thoroughly so I could be wrong.

This is correct - Mongo/Minimongo/Methods have some internals to make sure the IDs are generated the same way across client and server.

Create a uuid on the client, pass that to the server, easy peasy :wink:

1 Like

I think Random.id() will generate a Meteor id? https://atmospherejs.com/meteor/random not sure if it’s exactly the same.

it is generated using that random stream like starting line 746 https://github.com/meteor/meteor/blob/devel/packages/ddp-client/livedata_connection.js

and than it is used to generate actual ID by _makeNewID like line 62 https://github.com/meteor/meteor/blob/devel/packages/mongo/collection.js

so it pass random stream between client and server and you can generate new IDs based on it and they will be same.

@lai

True, I remembered the same, and was thinking about that when considering your issue #2

@sashko are you guys going to keep the livedata package now that you guys are pursuing a graphql approach to data?

Yes I expect it will be the right approach to use for at least 6 months, while we are building the new thing. DDP/livedata works great for a wide variety of cases, we just think the GraphQL approach will be more flexible for cases DDP doesn’t support well right now and for other data sources.

We will provide great guides about how to use them side by side and how to migrate if you want to once we have something that we can recommend.

1 Like