How can I add field Pointer/Relation to schema via function addField?

Docs says:

addField(name, type, options)
type (String)  Can be a (...Array|Object|**Pointer**|**Parse.Relation**)

But Pointer/Relation need targetClass as well, and there are no place for it (in options it does not work).

If you want to name the field “activity” and create a pointer to a class named “Activity”, you can do the following:

addPointer('activity', 'Activity')

I leave it as a fallback. Or is it the only way?

BTW Is there are another fields (except type, targetClass, required and defaultValue) within field described field (sorry for the pun)?

I’m not sure understand your question. Looking at his example may help

So addField does not work with Pointer or Relation as I understand, only with specific addPointer and addRelation. And there is a documentation error about using addField with these types.

P.S. I had to write:

   switch (type) {
      case 'Pointer':
        schema.addPointer(key, targetClass, options);
      case 'Relation':
        schema.addRelation(key, targetClass);
        schema.addField(key, type, options);

Interesting, I’ve never attempted to use addField to add a Pointer or Relation before. @davimacedo @dplewis @Manuel are more familiar with JS than I am. Do any of you see an issue in the documentation? It seems

schema.addField(key, 'Pointer', options);

should work based on what I see…

It does not work because you’d need to also specify the targetClass but it is not currently available in the options. So currently addPointer/addRelation is the right way to go.