Skip to content

week 3 hw#16

Open
ryancfields wants to merge 1 commit intopce-uw-jscript400:masterfrom
JSArchive:fields_w3_hw
Open

week 3 hw#16
ryancfields wants to merge 1 commit intopce-uw-jscript400:masterfrom
JSArchive:fields_w3_hw

Conversation

@ryancfields
Copy link

No description provided.


* **Your Answer:**

It is adding the primary key, the unique value.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not quite right. If you include the above in your code, it will require you to send an ObjectID when creating a new record.

* **Your Answer:**

---
module.exports = mongoose.model('Series', schema) will return all documents.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, I'm referring the .find() method.


* **Your Answer:**

It will fail on the schema validation.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It actually won't, unless you set up validations as part of it! You can submit partial data with Mongo.


* **Your Answer:**

async await method.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The question here is about what Mongoose method to use. For example, you can use .find() or .findById().

* **Question:** What are the arguments for `Model.updateOne()`?

* **Your Answer:**
updateOne will update the first one it finds vs. findOneAndUpdate requires the ID.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The arguments here are filter, doc, and then options.


* **Your Answer:**

I am not sure on this question.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should encounter an error when you run .create().select(). You will have to re-request the information or use the .save() method to return the updated record.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants