How could I predefine my schemas in the parse server cloud side?

Hi @sadortun,

For the fields part, is it conform to the JSON Schema specification as shown at below link? Thanks a lot.

Hello @davimacedo @sadortun @dblythy ,

Just would like to know the schema difference between the parse server and the http://json-schema.org/, or they are just the same or similar?

If they are the same, we could easily use tools to extract the json schema from the json sample data (like Best JSON to Jsonschema Converter or Free Online JSON to JSON Schema Converter), which is a big plus for parse server.

Great thanks for any help!

I am not familiar to json-schema, but Parse Server has its own schema and I guess they are probably different.

Hi @davimacedo ,

Thanks for reply. They are different while seems quite similar. Json-schema is the standard specification in this area to some extent, there are some tool chains already, like:

Just some idea: if parse server could adapted to support json-schema, many open source projects could be helpful out of the box to make parse server version 5 to be more stronger and easy to use.

Thanks for reading this post :slight_smile:

1 Like

Hello, @sadortun

How about the unique indexes implementation now? Thanks a lot.

We plan to implement unique indexes soon too.

It’s still something we want to add, but we don’t have any specific date for now.

Is there any way we can implement unique indexing, or is there any workaround available?

Hi @RahulLanjewar93 ,

This feature is now supported by Parse Server. Documentation is not merged, i see that you commented the PR.

I’m posting the PR link here if anyone wants to use this feature : docs: add defined schema docs by Moumouls · Pull Request #863 · parse-community/docs · GitHub

An example from a personal repo: parse-next-mono-starter/server.ts at master · Moumouls/parse-next-mono-starter · GitHub

@xeoshow also if you are interested by the feature :slight_smile:

2 Likes

Hi @Moumouls,

So the unique indexes implementation is included now? From which version?
Thanks v much.

Best regards, Jason

ahaha sorry for the misunderstanding @xeoshow .

The Defined Schema feature is now supported out of the box since 5.0 :slightly_smiling_face:

But the unique indexes are still not currently supported.

Hello @Moumouls ,

Just would like to know if the unique indexes are supported in the latest version, such as 5.4.0?

Thanks a lot.

Best regards, Jason

Hi @xeoshow , unique indexes/custom indexes are still not supported.

But, in my company we encountered an issue with the current interface of Parse Indexes, there are too restrictive. So maybe I’ll push a PR to allow a “non-restrictive mode” to allow a developer to create any indexes without validation or transformation. The goal is to send the index config directly to the DB.

Note: Official Defined Schemas docs are now released: Defined Schema Guide | Parse

@Moumouls Thanks for kind help.
Actually I met the problem described in this post:

I think maybe the simple solution is to create the unique indexes on the related fields, which should be “restrictive mode”, otherwise that bug still will happen.

BTW, we have already used the indexes in our schemas similar as below, but it looks like NOT unique index?

indexes: {
    tagsIndex: { tags: 1 },
    // The special prefix _p_ is used to create indexes on pointer fields
    cityPointerIndex: { _p_city: 1 },
    tagAndCityIndex: { _p_city: 1, tags: 1 },
  },

Any further help is highly appreciated.

Best regards, Jason

@xeoshow, the above index, are just normal indexes. Unique is a special config on the index definition.

Currently there is no good solution, I’ll keep you updated once a PR is sent :slightly_smiling_face:

1 Like

You can create standard indexes or unique indexes by accessing the adapter directly. I show code for how to do this here:

There are other types of indexes you are not able to create as @Moumouls pointed out, for those, I typically run a script to add them to the DB directly.

1 Like

Hello,

For the latest version 6.1.0, is the unique index feature supported now? Thanks a lot.