기본 콘텐츠로 건너뛰기

1월, 2020의 게시물 표시

What is mongoDB dbpath?

Where is the database folder? - You should be able to find the location in the configuration file : /etc/mongod.conf grep dbPath /etc/mongod/conf grep??? -grep searches for PATTERNS in  each FILE. PATTERNS is one or patterns separated by newline charactors, and grep prints each line that matches a pattern. If the default path is not given, mongo saves the data in the root directory as printed when grep dbPath /etc/mongodb/conf shows :  dbPath: /var/lib/mongodb otherwise, I can set a default path to save the data. from Mongodb : If you want  mongod  to store data files at a path other than  /data/db  you can specify a  dbPath . The  dbPath  must exist before you start  mongod . If it does not exist, create the directory and the permissions so that  mongod  can read and write data to this path. For more information on permissions, see the security operations documentation. source :  https://askubuntu.com/questions/982673/where-is-mongo-database-folder-on-the-

Debugging guide : commenting and logging steps

1. Check any possible typos 2. Calm down and read the code   comment every code step by step 3. Debugging. go back to step 2 till you figure the matter out   keep searching while looping step 2 and 3 I code to be into it not to be mat at it HAPPY CODING! app . post ( '/meower' , ( req , res )  =>  {    console . log ( '1. POST /mews request' );    if ( isValidMew ( req . body )) {      console . log ( '2.A. Body is valid' );      const   mew  = {        name:   req . body . name . toString ,        content:   req . body . content . toString ,        created:   new   Date (),     };      mews       . insert ( mew )       . then ( createdMew   =>  {          console . log ( '3.A Mew has been created' );          console . log ( createdMew );          //TODO       })       . catch ( err   =>  {          console . log ( '3.B Mew creation has failed' );          console . log ( err )       })

COR error : Cross Origin Resource

Access to fetch at 'http://localhost:5000/mews' from origin 'http://127.0.0.1:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. shows up when the ogirin resource localhost:8080 is trying to fetch data to localhost 5000 without this Access-Control-Allow-Origin header. in this project we will be using a package to prevent this error on server side.

Why do I need initialize an empty array attribute of datamodel?

https://moonformeli.tistory.com/3 export   default   class   GiftList   extends   Component  {      constructor ( props ){          super ( props );          //what is this for??          this . state  = { gifts:  []};     } } //the answer is in the link, have fun!

non-editable input type="text'?!

Yes. i am still working on that MERN stack project like since forever and i am not ashamed of it! However however, I found an error, from one of the pages, i could not edit the input text. and it was because I set the onChange function in a wrong way. < div   className = "form-group" >                          < label > Gift Name: </ label >                          < input   type = "text"                          required                          className = "form-control"                          value = {this . state . gift  ||  "" }                          onChange = {this . onChangeGift }                          //setting on change to be                          //onChange={this.state.onChangeGift}                          //prevents editing from user                          />                      </ div > So, since onChange function is already bind to the state, I mean t

mongoDB error : "Error: MongoError: E11000 duplicate key error collection: test.santas index: username_1 dup key: { username: null }"

https://www.freecodecamp.org/forum/t/mongoerror-e11000-duplicate-key-error-collection-timeformationbd-formations-index-description-1-dup-key-null/212336 I was working on this santa helena website. today I was building the components, creating a page for creating new santa. But adding new santa made an error and there above was the error message and how I got to solve it. I don't yet really get what was wrong with my very first collection. maybe there must be some difference with those ones which can be created by my page, cuz the first one was made by Insomnia the API testing program. ------update still getting errors. its weird that the data model for santa, the one that i modeled after has unique attribute but still works well. https://stackoverflow.com/questions/57507314/i-am-getting-this-mongo-error-e11000-duplicate-key-error-collection-21day-cha

[ReactJS]Module not found: Can't resolve 'react-router-dom'

The error message "Module not found: Can't resolve 'react-router-dom'" would show up when the project does not have the package 'react-router-dom' as dependencies in your package.json file or whatever the equivalent you use to manage the dependencies in your project that could be solve as typing the following line in terminal, at your project directory  (if using yarn, do yarn install react-router-dom) npm i -S react-router-dom