D
D
Dmitry2015-03-21 10:16:13
MongoDB
Dmitry, 2015-03-21 10:16:13

How to change schema from relational database to mongoose(mongodb)?

There is a base for storing positions in the search:
Projects:
name
domain
region
... some other fields
Queries:
name
relation to the project
Updates:
date
Positions:
position
relation to the request
relation to the update
How is it correct to translate this into the mongoose schema?
mongoosejs.com/docs/guide.html
As I understand it, you need to use an array?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2015-03-21
@Zverushko123

decided to use this

var promoSchema = new Schema({
    Domain: String,
    region: Number,
    positions: [{
        query: String,
        num: Number,
        date: Date
    }]
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question