Get Free Trial
API reference
Table of contents

getSchema

getShema(mongoDBInstance: Db instance, index: String)

[starting from version: 2.8]

This API call allows getting the list of all fields with their types from a MongoDB database. Used in the handler of the Flexmonster /fields request. The getShema method is a part of the Flexmonster MongoDB Connector API.

Parameters

  • mongoDBInstanceDb instance. The instance of the needed MongoDB database.
  • index – String. The collection’s name. index is sent in the body of the Flexmonster request.

Returns

Array of field objects, which contains all the fields and information about them. The response format is the same as in the /fields request.

Example

mongo.post("/fields", async (req, res) => {
    try {
const result = await MongoDataAPI.getSchema(mongoDBInstance, req.body.index);
res.json(result.toJSON());
    } catch (err) { }
});

See also

getMembers
getSelectResult