frontendmasters / intro-mongo-db Goto Github PK
View Code? Open in Web Editor NEW[Course] Introduction to MongoDB code
Home Page: https://frontendmasters.com/courses/mongodb/
[Course] Introduction to MongoDB code
Home Page: https://frontendmasters.com/courses/mongodb/
Whenever I try to test the first exercise. Jest throws an error Thrown: Undefined
for all tests. Searching online it seems to a problem with the async code, I tried to fix it myself but still it errors out
There is many databases creating from test since I use VS-Code test runner but it not getting removed after test.
Getting this error MongoError: server is closed
right before the should have correct fields
user test when running this command: yarn test exercises/models/__test__/user.spec.js
. Strangely if I remove the previous betaUser should default to false
test, the error goes away.
Full error:
MongoError: server is closed
at executeWriteOperation (node_modules/mongodb/lib/core/sdam/server.js:439:14)
at Server.insert (node_modules/mongodb/lib/core/sdam/server.js:372:5)
at Object.callback (node_modules/mongodb/lib/core/sdam/topology.js:938:15)
at processWaitQueue (node_modules/mongodb/lib/core/sdam/topology.js:1036:21)
at NativeTopology.selectServer (node_modules/mongodb/lib/core/sdam/topology.js:440:5)
at executeWriteOperation (node_modules/mongodb/lib/core/sdam/topology.js:906:12)
at NativeTopology.insert (node_modules/mongodb/lib/core/sdam/topology.js:595:5)
at NativeTopology.insert (node_modules/mongodb/lib/topologies/native_topology.js:54:11)
at insertDocuments (node_modules/mongodb/lib/operations/common_functions.js:259:19)
at InsertOneOperation.execute (node_modules/mongodb/lib/operations/insert_one.js:26:5)
at executeOperation (node_modules/mongodb/lib/operations/execute_operation.js:77:17)
at Collection.Object.<anonymous>.Collection.insertOne (node_modules/mongodb/lib/collection.js:516:10)
at NativeCollection.<computed> [as insertOne] (node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js:171:28)
at model.Object.<anonymous>.Model.$__handleSave (node_modules/mongoose/lib/model.js:273:33)
at model.Object.<anonymous>.Model.$__save (node_modules/mongoose/lib/model.js:337:8)
at node_modules/kareem/index.js:278:20```
hey there! I'm having issues with getting tests to pass with the models exercises.
git clone url
npm install
npm test exercises/models/__test__/
on the connect.js file I entered this
const mongoose = require('mongoose')
mongoose.Promise = global.Promise
const connect = () => {
return mongoose.connect('mongodb://localhost:27017/usersDatabase')
}
module.exports = connect
Hi, i have a question about a filter...
I wanna create a filter for example the request might be
name contains ´test´, bussiness equals ´worktest´
so with that i wanna create a query for filter information on my mongodb collection
any idea about this¿? someone please help me
I have on the start user.js
betaUser: { type: Boolean, default: false },
like that but the test is not passing it? betaUser should default to false (11ms)
Here is the full schema
const mongoose = require('mongoose') const userSchema = new mongoose.Schema({ firstName: { type: String, required: true }, lastName: { type: String, required: true }, email: { type: String, required: true, unique: true }, betaUser: { type: Boolean, default: false }, birthDate: Date, address: { other: Boolean, street: String, houseNumber: Number, zip: Number, city: String, State: String }, pets: [{type: String}] }) module.exports = mongoose.model('user', userSchema)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.