Reputation: 112877
I have a deepstream server connected to RethinkDB with the official connector.
server.set( 'storage', new RethinkDbConnector({
port: 28015,
host: rethinkDbHost,
splitChar: '/',
defaultTable: 'ds-records'
}));
There are no tables in the database at first.
When I create a record, a table is created automatically if it does not exist.
var id = "chat/" + ds.getUid();
var record = ds.record.getRecord(id);
record.whenReady(function() {
record.set({user: data.user, message: data.message, timestamp: Date.now(), id: id});
});
Table created as intended.
However, if I try to create a "nested table", it does not work.
var id = "chat/idle_banter/" + ds.getUid();
var record = ds.record.getRecord(id);
record.whenReady(function() {
record.set({user: data.user, message: data.message, timestamp: Date.now(), id: id});
});
No table is created when trying to create a record with the name 'table/collection/id'
Do I have to create a table manually first, and then add the collection?
Clumsy use of terms on my part. I wish to create a table representing the entire chat, and then create a document that represents the actual room. New chat messages (records) would then be put in this document.
Upvotes: 0
Views: 324
Reputation: 1094
I have to admit that I don't think that RethinkDB supports a concept of nested tables. If you'd like to create a table per chat, just use a character other than the splitChar
, e.g. 'chat-idle_banter/<recordName>'
Upvotes: 1