N
N
Nick932016-06-09 14:05:27
JavaScript
Nick93, 2016-06-09 14:05:27

What is the best way to organize the model in the base for the chat room?

What is the best way to organize the model in the base for the chat room. So far I have this model.

var schema = new Schema ({

name: {
    type: String,
    required: true
},

inPrivate: {
    type: Boolean,
    required: false,
    default: false
},

location: {
    type: [Number],  // [<longitude>, <latitude>]
    index: '2d'
},

radius : Number,

created: {
    type: Date,
    default: Date.now
}});

There is a room that has a radius, I want to make it so that users who are within the radius of this room can send messages to each other. Having studied the mongodb docks, I realized that you should not make an array of users in the schema, since mongodb can store an object no more than 16 megs. So can use standard rooms in socket.io and assign room id from mongodb to them?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Boltik, 2016-06-17
@BOLTIKUS

So can use standard rooms in socket.io and assign room id from mongodb to them?

I did just that.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question