I have a collection named users and I'm trying to add a user to the collection the code I'm using is
var user1 = {
Username: "joonyoftv",
Password: "joon123",
Email: "joony@bmail.com",
Birthday: {
new Date: ( "2000-08-02")
},
FavoriteMovies: [ 61942e53b8d3d951230f0980, 61943aabb8d3d951230f0983 ]
}
but i keep on getting an error that says SyntaxError: missing : after property id : @(shell):6:7 What should i do?
It's just a simple JavaScript syntax error!
The new Date: ( "2000-08-02")" should not be in curly braces and ids in FavoriteMovies array should be enclosed in string literals.
Object with correct syntax:
var user1 = {
Username: "joonyoftv",
Password: "joon123",
Email: "joony@bmail.com",
Birthday: new Date("2000-08-02"), // corrected
FavoriteMovies: ["61942e53b8d3d951230f0980", "61943aabb8d3d951230f0983"],
//String ^ ^ ^ ^
};