Problem when inserting into the Mongo database

0

This is my code, even if I put the double quotes "", I get the error.

Code:

$ db.contactlist.insert({nombre:'Daniela', correo:'[email protected]', numero:'(506) 6188-4715'})

I get this error:

  

bash: syntax error near unexpected token '{name:' Daniela ','

    
asked by Daniela Arce Hernandez 26.06.2017 в 21:52
source

2 answers

0

If you try using db.contactlist.insertOne({nombre:'Daniela', correo:'[email protected]', numero:'(506) 6188-4715'}) you can serve.

    
answered by 14.04.2018 в 18:15
-2

(Edited) This error can appear when you are not positioned on any base. Before that insert, you may have forgotten to do use db TuBaseDeDatos for db. point to the base where contactlist is located. This is necessary for db to be a valid reference. Strong.

    
answered by 26.06.2017 в 22:21