Ephemeral collections

My app is running in production and I would like to add collaborative tools with convergence.

Data is stored in a mongoDB database and I want to keep this single point of truth of data.
I don’t want to use convergence as a database but just as a collaborative server.

So I would like an auto clean of collections. The user at the beginning get the data from Mongo and init a collaborative session with the data.If a second user come, he will use the data from convergence sync.
The first user will be the master of data and initiate the saving to the mongoDB. If he lost connection, the second become the master, etc.

Do you think it’s an appropriate approach ?

I saw an “ephemeral” attribute to the model but I don’t know what it does. The Javadoc is empty about it. I tried it but after a restart of convergence, the data is again in the convergence database.

Thanks for the question. We will add some API documentation for the ephemeral flag. When using model.openAutoCreate(), if you set “ephemeral” to true, then when the last person closes the model it should be deleted from Convergence. It should not be deleted on restart, but rather deleted when the model is closed by all collaborators. I think this would work for your use case. If this is not working let us know.

Ok ! Thanks for this response.
I will try the ephemeral flag.

I have just an interogation about the “closed by all collaborators” aspect.
My use case is to have an unique “owner” of a projet. This projet would be shared to invited people.
I would like the owner has the possibility to close alone a projet.
Perhaps I will need to implement a specific mecanism myself ? I downloaded the Postman convergence api file. It’s great to have that !

Yes. I think you would have to implement that logic yourself. You should be able to do it with the javascript client.

I don’t know if it’s a “normal” problem but I can’t remove an ephemeral model in the admin console.

Here the log of convergence.

I will take a look. Generally you would not need to remove an ephemeral model from the admin console. In that as soon as the client disconnects the model would be removed. The only way to delete an ephemeral model would be to delete it while a client has it open. I wouldn’t imagine you would WANT to do this. But it should work.

Can you describe the steps you took?

My goals was just to clean the collections during my development process because I created a lot of models from the same collection for my tests.

Yes, it’s not a production classical action.

All the models was created with ephemeral but stays in database even if I reload the browser.

I did not call the close function.

I’ll take a look at that. An ephemeral model should be deleted automatically when the last client disconnects.