UNPKG

1.46 kBMarkdownView Raw
1# Compass Query Bar [![][workflow_img]][workflow_url]
2
3> Renders a component for executing MongoDB queries through a GUI.
4
5## Usage
6
7### Browser
8
9Setting values via configure:
10
11```js
12import Plugin, { configureStore, configureActions } from '@mongodb-js/compass-query-bar';
13
14const actions = configureActions();
15const store = configureStore({
16 localAppRegistry: appRegistry,
17 actions: actions,
18 namespace: 'db.coll',
19 serverVersion: '4.2.0',
20 fields: [],
21});
22
23<Plugin store={store} actions={actions} />
24```
25
26### Hadron/Electron
27
28```js
29const role = appRegistry.getRole('Query.QueryBar')[0];
30const Plugin = role.component;
31const configureStore = role.configureStore;
32const configureActions = role.configureActions;
33
34const actions = configureActions();
35const store = configureStore({
36 globalAppRegistry: appRegistry,
37 localAppRegistry: localAppRegistry,
38 actions: actions,
39 namespace: 'db.coll',
40 serverVersion: '4.2.0',
41 fields: []
42});
43
44<Plugin store={store} actions={actions} />
45```
46
47### Fields
48
49The fields array must be an array of objects that the ACE editor autocompleter understands. See
50[This example](https://github.com/mongodb-js/ace-autocompleter/blob/master/lib/constants/accumulators.js)
51for what that array looks like.
52
53[workflow_img]: https://github.com/mongodb-js/compass-query-bar/workflows/Check%20and%20Test/badge.svg?event=push
54[workflow_url]: https://github.com/mongodb-js/compass-query-bar/actions?query=workflow%3A%22Check+and+Test%22