Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

107
Views
add a user into collection in Mongodb

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?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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         ^                        ^  ^                        ^
};
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!