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 |
|
9 | Setting values via configure:
|
10 |
|
11 | ```js
|
12 | import Plugin, { configureStore, configureActions } from '@mongodb-js/compass-query-bar';
|
13 |
|
14 | const actions = configureActions();
|
15 | const 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
|
29 | const role = appRegistry.getRole('Query.QueryBar')[0];
|
30 | const Plugin = role.component;
|
31 | const configureStore = role.configureStore;
|
32 | const configureActions = role.configureActions;
|
33 |
|
34 | const actions = configureActions();
|
35 | const 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 |
|
49 | The 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)
|
51 | for 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
|