Coder Social home page Coder Social logo

dnd-test's Introduction

dnd-test

What to do:


  1. Build the db on localhost
  • Global install generate-schema and build schemas

    • npm install -g generate-schema

    • now you need a single json object out of each of the arrays, check test.json

    • run generate-schema test.json -m the dash m is the flag for mongoose schema set

    • this will give you an object output and can be placed directly into your schema.

    • check Feature.js this is a schema for feature, don't deviate from the current setup it is there for a reason.

  • Before the next step I tested a post route and a get route with hardcoded values, they are in here. This assured me that all would work as planned.

  • import all the datasets to localhost the same way you imported datasets to the cloudDb

    • Find and replace all the url pathnames -> - find . -name '*.json' -print0 | xargs -0 sed -i "" "s/http:\/\/www.dnd5eapi.co\//http:\/\/localhost:5000\//g"

    • mongoimport -h localhost:27017 -d dnd-test -c feature --file upload-5e-SRD-features.json --jsonArray dnd-test was the name I chose

  1. Export each collection in the database from localhost -> mongoexport --db dnd-test --collection feature --out feature.json
  • run the command to update all the pathnames inside all .bson and .json files

    • update all your pathnames agian -> find . -name '*.json' -print0 | xargs -0 sed -i "" "s/localhost:5000\//https:\/\/shrouded-stream-28894.herokuapp.com\//g"
  • you may need to shell into your db and drop all the databases

    • Shell in -> mongo ds251548.mlab.com:51548/heroku_snj3hp52 -u heroku_snj3hp52 -p 8jek722hat1819subntj0b00mk

    • get collection names -> let names = db.getCollectionNames()

    • users do not have write privilege on system indexes loop through the rest -> names.forEach((name)=> {if(name != "system.indexes")db[name].drop();});

  • now import each to your database -> mongoimport -h localhost:27017 -d dnd-test -c feature --file upload-5e-SRD-features.json

Document process for find and replace


I googled -> find and replace in all files in directory mac

like this

first link in results, third answer

this one didn't work -> find . -type f -name 'test.json' -exec sed -i '' s/http:\/\/www.dnd5eapi.co\//http:\/\/localhost:5000\// {} +

didn't help

I originally found this -> find . -name '*.txt' -print0 | xargs -0 sed -i "" "s/form/forms/g"

needed to double check I was doing this right

And changed it to this -> find . -name 'test.json' -print0 | xargs -0 sed -i "" "s/http:\/\/www.dnd5eapi.co\//http:\/\/localhost:5000\//g"

mongoimport -h localhost:27017 -d dnd-test -c feature --file upload-5e-SRD-features.json --jsonArray

dnd-test's People

Contributors

ed42311 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.