123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- /*
- * Copyright 2016-present Pnoker All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * https://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- db = db.getSiblingDB("admin");
- db = db.getSiblingDB("authorization");
- if (!db.getUser("admin")) {
- db.createUser({
- user: "admin",
- pwd: "dc3",
- roles: [
- {
- role: "readWrite",
- db: "authorization",
- },
- ],
- });
- }
- db = db.getSiblingDB("admin");
- if (!db.getUser("admin")) {
- db.createUser({
- user: "admin",
- pwd: "dc3",
- roles: [
- {
- role: "readWrite",
- db: "admin",
- },
- ],
- });
- }
- db = db.getSiblingDB("dc3");
- if (!db.getUser("dc3")) {
- db.createUser({
- user: "dc3",
- pwd: "dc3",
- roles: [
- {
- role: "readWrite",
- db: "dc3",
- },
- ],
- });
- }
- if (db.createCollection("point_value")) {
- db.pointValue.createIndex(
- {
- deviceId: 1,
- pointId: 1,
- },
- {
- name: "IX_device_point_id",
- unique: false,
- background: true,
- }
- );
- db.pointValue.createIndex(
- {
- createTime: 1,
- },
- {
- name: "IX_create_time",
- unique: false,
- background: true,
- }
- );
- }
- if (db.createCollection("driver_event")) {
- db.driverEvent.createIndex(
- {
- driverId: 1,
- },
- {
- name: "IX_driver_id",
- unique: false,
- background: true,
- }
- );
- db.driverEvent.createIndex(
- {
- createTime: 1,
- },
- {
- name: "IX_create_time",
- unique: false,
- background: true,
- }
- );
- }
- if (db.createCollection("device_event")) {
- db.deviceEvent.createIndex(
- {
- deviceId: 1,
- pointId: 1,
- },
- {
- name: "IX_device_point_id",
- unique: false,
- background: true,
- }
- );
- db.deviceEvent.createIndex(
- {
- createTime: 1,
- },
- {
- name: "IX_create_time",
- unique: false,
- background: true,
- }
- );
- }
|