Task: I am trying to create a collaborative document editor using Meteor and have used the following if statement to create a new document within a MongoDB database:
if (!Documents.findOne()){// no documents yet!
Documents.insert({title: "my new document"});
}
});
}
After running the app at : [http://localhost:3000/] and inputting the following code to the Console area in inspect:
Documents.findOne()
Problem: Uncaught reference error in the Console:
VM170:1 Uncaught ReferenceError: Documents is not defined
Outcome: I would like "my new document" to be found for the following message to appear:
Object {_id: "", title: "my new document"}
This is so I know my code is working and a new document has been added the the database.
How can I make "my new document" appear alongside the Object id?
Aucun commentaire:
Enregistrer un commentaire