Skip to content

How would I use ParseServer if I inserted this custom JSON into ParseObjects in MongoDB #4534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mginz83 opened this issue Jan 31, 2018 · 2 comments
Labels
type:question Support or code-level question

Comments

@mginz83
Copy link

mginz83 commented Jan 31, 2018

Usually, when dealing with a ParseObject from MongoDB, its a simple, well, JSON object like so.

{
 "_id": "g5Sf4GN86S",
 "name": "kevin"
}

What if I kept the _id and replaced everything else with the following JSON

[
  {
    "name": "recipe",
    "serves": "4",
    "prep_time": "10 mins",
    "cook_time": "10 mins",
    "ingredients": [
      "item 1",
      "item 2",
      "item 3"
    ],
    "cooking_instructions": [
      "Step 1",
      "Step 2"
    ],
    "nutrition_facts": [
      {
        "fact 1",
        "fact 2"
      }
    ],
    "credit": "google.com",
    "image": "http://www.website.com/image.jpg"
  }
]

Can something like this be parsed with ParseServer?

@bohemima
Copy link
Contributor

bohemima commented Feb 1, 2018

If you added the corresponding keys with correct type for schema, sure.

name: String
Serves: Number
ingredients: Array
etc

@montymxb montymxb added the type:question Support or code-level question label Feb 1, 2018
@montymxb
Copy link
Contributor

montymxb commented Feb 1, 2018

Pretty much as bohemima said, there are numerious data types, and you can set up a type of Array and set your entire json to that if you want. In the js sdk you can see what data types you can work with. I would recommend you look over the docs for your use case to figure out what data types you need and how you would implement them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question Support or code-level question
Projects
None yet
Development

No branches or pull requests

3 participants