LogoLogo
  • Introduction
  • Features
  • Getting Started
    • Cortex User Guide
      • Organizations
      • Log in
      • Generate an API key
      • Make your first API request
      • Configure the org settings
      • Set up a data model
        • Create custom objects
        • Add custom properties
      • One-to-many relationships
      • Read and write data
      • Making a Request
      • Handling responses
      • Authentication
      • Two-factor authentication
      • Set third-party cookies
      • Connections
      • Upload files
      • Cortex iOS
      • Get started with Swift
      • Cortex service accounts
      • Cortex developer tools
      • Automated Account Notifications
  • Cortex API
    • Overview
    • Objects
      • Objects Overview
      • Organization
      • Account
      • Connections
      • Notifications
      • Stats
      • Logs
      • Export
      • Events
      • Room
    • Object Definition
      • Object Properties
        • Any
        • Binary
        • Boolean
        • Date
        • Document
        • File
        • Geometry
        • List
        • Number
        • ObjectId
        • Reference
        • String
    • Object Types
    • Access Control
    • Querying
      • Query Operators
      • Property Selection
      • Property Access
    • Aggregating
      • Aggregation Operators
    • Scripting
      • Script Types
      • Script Limits
      • ObjectId
      • CortexObject
        • Accounts
        • Views
      • Cursors
      • Operations
      • Script Modules
        • API Module
        • Base64 Module
        • Cache Module
        • Connections Module
        • Console Module
        • Consts Module
        • Counters Module
        • Crypto Module
        • HTTP Module
        • Logger Module
        • Notifications Module
        • Request Module
        • Response Module
        • SAML Module
        • Schemas Modules
        • Script Module
        • Session Module
        • Util.id Module
        • Util.ip Module
        • Util.paths Module
        • XML Module
        • Developer
        • Config
        • Renderer
        • SFTP
        • FTP
        • DB
          • Cursors
          • Driver
      • Static Methods
        • Accounts
        • Views
        • Cursors
      • Audit
      • Environments
      • HTTP Driver
      • Notifications
        • Firebase Cloud Messaging (FCM)
        • Tencent Push Notification Service Configuration
      • Televisit
      • Transforms
      • Localization
      • Available Javascript Libraries
    • Decorators
      • Runtime
        • Acl
        • As
        • Log
        • Profile
      • Static
        • Env
        • Job
        • Object
        • On
        • Policy
        • Route
        • Transform
        • Trigger
    • Expressions
      • Primer
      • Pipelines
      • Operators
      • Accumulators
      • Variables
      • Conditionals
      • Transforms
      • Triggers
      • On
      • Events
    • Faults
      • Fault Reference
  • Releases
    • Cortex Release Notes
      • Cortex API 2.28.3 (R3.4.6)
      • Cortex API 2.28.1 (R3.4.3)
      • Cortex API 2.27.2 (R3.4.1)
      • Cortex API 2.27.1 (R3.3.5)
      • SQL DB Connector 1.3.4 (R3.3.3)
      • Cortex API 2.26.2 (R3.3.1)
      • Cortex API 2.26.1 (R3.2.2)
      • Cortex API 2.26.0 (R3.2.1)
      • SQL DB Connector 1.3.3
      • Cortex API 2.25.0 (R3.1.1)
      • SQL DB Connector 1.3.2 (R3.1.0)
      • Cortex API 2.24.2 (R3.0.2)
      • SQL DB Connector 1.3.1 (R3.0.0)
      • Cortex API 2.24.1 (R2.3.3)
      • Cortex API 2.24.0 (R2.3.2)
      • SQL DB Connector 1.3.0 (R2.3.0)
      • Cortex API 2.23.0 (R2.2.4)
      • SQL DB Connector 1.2.0 (R2.2.0)
      • Cortex API 2.22.2 (R2.1.2)
      • Cortex API 2.22.1 and SQL DB Connector 1.1.1 (R2.0.1)
      • Cortex API 2.22.0
      • Cortex API 2.21.3
      • Cortex API 2.21.2
      • Cortex Web 4.16.0
      • Cortex Web 4.15.1
      • Cortex API 2.20.1
      • Cortex Web 4.14.0
      • Cortex Renderer 1.3.3
      • Cortex API 2.19.4
      • Cortex API 2.19.3 and Cortex Web 4.13.1
      • Cortex Renderer 1.3.2
      • Cortex API 2.19.1
      • Cortex API 2.18.0
      • Cortex API 2.17.6
      • Cortex API 2.17.5
      • Cortex API 2.17.4
      • Cortex API 2.17.3
      • Cortex API 2.17.2
      • Cortex API 2.17.1
      • Cortex API 2.16.0
      • Cortex API 2.15.9
      • Cortex API 2.15.8-1
      • Cortex 2.15.8
      • Cortex API 2.18.1
      • Cortex API 2.16.1
      • Cortex Renderer 1.3.1
      • Cortex Renderer 1.3.0
      • Cortex Renderer 1.2.2
      • Cortex Renderer 1.2.1
      • Cortex Renderer 1.2.0
    • Third-Party License Attribution

© 2025 Medable, Inc. All rights reserved.

On this page
  • module developer.sessions
  • logout(account)
  • module developer.locations
  • list({ where, pipeline, sort, skip, limit })
  • remove( _id )
  • module developer.environment
  • Include
  • export(options)
  • import(payload, options)
  • Examples
  • Export a definition

Was this helpful?

  1. Cortex API
  2. Scripting
  3. Script Modules

Developer

Developer environment tools

const developer = require('developer')

The Developer module exposes various developer-centric environment functionality.

This module is available on development endpoints.

module developer.sessions

const { sessions } = require('developer')

logout(account)

Logs out sessions for an account. If called from a script by the target account during a session and the current session is in the context of the calling request, the caller's session is not closed.

Once closed, the first authenticated access by the target account for any existing sessions results in a cortex.accessDenied.loggedInElsewhere fault.

Arguments

  • account { String | ObjectID } The account email or ID of the target for which sessions are forcibly ended.

module developer.locations

const { locations } = require('developer')

list({ where, pipeline, sort, skip, limit })

Queries environment devices.

Arguments

  • options { Object }

    • where { Object } A query match object.

    • pipeline { Object } An aggregation pipeline object.

    • sort { Object } A query sort object.

    • skip { Number = 0 }

    • limit { Number = Undefined }

Returns

  • list { Object } A list object.

    • hasMore { Boolean } true for more results.

    • data { Object[] } An array of location objects.

    • object { String } "list".

remove( _id )

Removes a device location by _id.

Arguments

  • _id { ObjectID } The ID of the device location to be removed.

Returns

  • location { Object } The location object removed. Returns cortex.notFound.unspecified error if not found.

module developer.environment

The following updates are made to Cortex's environment import process in Cortex API 2.17.0:

  • Policies are disabled during import and package install.

  • Backups and triggers are false by default during import.

  • Memo parameter is accessible during ingest and export pipes.

  • Memo parameter is accessible to the beforeImport, afterImport, beforeExport, afterExport scripts.

Include

const { environment } = require('developer')

export(options)

Exports an environment.

Arguments

  • options { Object }

    • manifest { Object } A manifest definition that determines what to export.

    • preferUrls { Boolean = true } When true, exports signed URLs for file data where possible. When false,

      file data is base64-encoded into chunked resource stream objects.

    • silent { Boolean = false } When true, manifest entries without unique keys will be ignored. By default, a cortex.unsupportedOperation.uniqueKeyNotSet fault is occurs.

Returns

  • { Cursor } A cursor to output documents.

import(payload, options)

Imports to an environment.

Arguments

  • payload { Cursor | Object[] } An import stream of documents defining the import (manifest and resources).

  • options { Object }

    • backup { Boolean = true } When true, the deployment mechanism puts the environment into maintenance mode and forces a wholesale rollback if an import error occurs.

    • triggers { Boolean = true } When set to false, script triggers for updated or inserted resources are skipped.

    • production { Boolean = false } In the future, script-based imports may be allowed in production. As a safety measure, the production flag must be set when in production and only when in production.

Returns

  • { Cursor } A cursor to input result documents.

Examples

Export a definition

const { environment } = require('developer')

return environment.export({
  manifest: {            
    objects: [{
      name: 'c_example',
      includes: ['*']
    }]
  }
})

Last updated 3 years ago

Was this helpful?

View the GitHub topic for more information about environment import and export.

mdctl-cli