I have the following Schema:
var userSchema = mongoose.Schema({
local : {
email : String,
password : String,
movies : [{
moviename : String,
rating : Number
}],
}
});
My questions are:
Can I save entries to the one after the other. I.e. can I save movies sequentially, and not all the movies (array entries) at the same time? In other words, can the movies array grow dynamically?
What I am trying to do is:
user.movies = { moviename : "Top Gun",
rating : 80};
user.save(function (err) {
if (err)
console.log("Error in saving");
res.end(0);
});
I believe the saving is working as I get not errors, but I'm lost at how to retrieve the entries in the array. Could someone please give me an example or a reference how to access the entries. Also, any other reference about the limitations, such as duplicate array entries (same movie).
Thank you.