Working with 2.x services

    Legacy compatibility mode is strictly intended as a temporary stopgap solution for supporting existing services whileupgrading to ArangoDB 3.xand is not a permanent feature of ArangoDB or Foxx. It is consideredas deprecated from v3.4.0 on.

    In order to mark an existing service as a legacy service,make sure the following attribute is defined in the service manifest:

    This denotes that the serviceis known to work with ArangoDB 2.8.0 and supports all newer versions ofArangoDB up to but not including 3.0.0 and later.

    Any similar version range the does not include 3.0.0 or greater will havethe same effect (e.g. will also trigger the legacy compatibility mode,as will 1.2.3, but >=2.8.0 will not as it indicates compatibilitywith all versions greater or equal 2.8.0,not just those within the 2.x version range).

    • main is ignored
    • controllers will be mounted as in 2.8
    • exports will be executed as in 2.8Additionally the isSystem attribute will be ignored if present butdoes not result in a warning in legacy compatibility mode.

    The Foxx console is available as the console pseudo-global variable(shadowing the global console object).

    The service context is available as the applicationContext pseudo-globalvariable in the controllers, exports, scripts and tests as in 2.8.The following additional properties are available on the service contextin legacy compatibility mode:

    • path() is an alias for 3.x fileName() (using path.join to build file paths)
    • fileName() behaves as in 2.x (using fs.safeJoin to build file paths)
    • is an alias for 2.x fileName
    • version exposes the service manifest’s version attribute
    • name exposes the service manifest’s name attribute
    • use() – use @arangodb/foxx/controller instead

    • apiDocumentation() – use controller.apiDocumentation() instead
    • @arangodb/foxx/authentication

    • @arangodb/foxx/console
    • @arangodb/foxx/controller
    • @arangodb/foxx/model
    • @arangodb/foxx/query
    • @arangodb/foxx/repository
    • @arangodb/foxx/sessions
    • @arangodb/foxx/template_middlewareThe @arangodb/foxx module also provides the same exports as in 2.8, namely:

    • Controller from @arangodb/foxx/controller

    • createQuery from @arangodb/foxx/query
    • Model from @arangodb/foxx/model
    • Repository from @arangodb/foxx/repository
    • toJSONSchema from @arangodb/foxx/schema
    • getExports and requireApp from @arangodb/foxx/manager
    • queues from Any feature not supported in 2.8 will also not work in legacy compatibility mode.When migrating from an older version of ArangoDB it is a good idea tomigrate to ArangoDB 2.8 first for an easier upgrade path.

    Additionally, please note the differences laid out in the chapter onmigrating from pre-2.8 in the migration guide.