Underbase

Underbase

  • Docs
  • Guides
  • API
  • GitHub

›API

Get started

  • Introduction
  • Installation
  • Configuration
  • Writting migrations
  • Module usage
  • Logging
  • Troubleshooting

Guides

  • Organizing migrations
  • Babel usage
  • Working with backups
  • Typescript usage

API

  • Module
  • Configuration API
  • Query Interface
  • Module for development
Edit

Query Interface

Reference

cursorOptions

MongoDB aggregator cursor options. See MongoDB API reference.

The default value is :

{
  cursor: {
    batchSize: 500,
  },
  allowDiskUse: true,
}

You can set your own value :

Query.cursorOptions = {
  cursor: {
    batchSize: 500,
  },
  allowDiskUse: true,
};

collection()

Use a given collection. Returns an instance of MongoCollection which is described below.

Example :

Query.collection('users');

MongoCollection

rename()

Rename a field in a collection. Returns a Promise.

Example :

Query.collection('users')
  .rename('dateCreated', 'datecreated')
  // .rename(field_name, new_field_name)
  .where({});

remove()

Remove a document in a collection. Returns a Promise.

Example :

Query.collection('users')
  .remove()
  .where({
    isDeleted: true,
  });

drop()

Drop an entire collection. Returns a Promise.

Example :

Query.collection('users').drop();

unset()

Unset a field in a collection. Returns a Promise.

Example :

Query.collection('users')
  .unset('isDeleted')
  .where({
    isDeleted: {
      $exists: false,
    },
  });

set()

Set a field in a collection. Returns a Promise.

Example :

Query.collection('users')
  .set('isDeleted', false)
  .where({
    isDeleted: {
      $exists: false,
    },
  });

count()

Count documents in a collection. Returns a Promise.

Example :

Query.collection('users').count({
  isDeleted: {
    $exists: false,
  },
});
← Configuration APIModule for development →
  • Reference
    • cursorOptions
    • collection()
  • MongoCollection
    • rename()
    • remove()
    • drop()
    • unset()
    • set()
    • count()
Underbase
Guides
Working with backupsWorking with continuous deploymentAPI Reference
Community
Stack OverflowIssues tracker
More
Release notesGitHub