@mongosh/autocomplete
MongoDB Shell Autocomplete Package
Last updated 2 months ago by addaleax .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @mongosh/autocomplete 
SYNC missed versions from official npm registry.

@mongosh/autocomplete

Package for MongoDB Shell

Usage

const autocomplete = require('@mongosh/autocomplete');
const serverVersion = '4.4.0';
const line = 'db.coll.fin';
const completions = autocomplete(serverVersion, line);
if (!completions || !completions.length) {
  return [];
}
const entries = completions[0].map((completion) => {
  return {
    completion
  };
});

API

completions = autocomplete(serverVersion, line)

serverVersion: current version of MongoDB line: current line to autcomplete

Returns an array of completions, and the line we were autocompleting. For example:

const autocomplete = require('@mongosh/autocomplete');
const serverVersion = '4.4.0';
const line = 'db.coll.re';
const completions = autocomplete(serverVersion, line);
// returns:
// [
//   [ 'db.coll.renameCollection', 'db.coll.replaceOne', 'db.coll.reIndex' ],
//   'db.coll.re' 
// ]

Autocomplete is based on currently implemeted APIs in @mongosh/shell-api

Installation

npm install -S @mongosh/errors

Current Tags

  • 0.6.1                                ...           latest (2 months ago)

4 Versions

  • 0.6.1                                ...           2 months ago
  • 0.6.0                                ...           2 months ago
  • 0.5.2                                ...           2 months ago
  • 0.5.1                                ...           2 months ago
Downloads
Today 0
This Week 3
This Month 3
Last Day 0
Last Week 0
Last Month 12
Dependencies (3)
Dev Dependencies (1)

Copyright 2014 - 2017 © taobao.org |