@indra.ai/deva.data 0.0.124 → 0.0.126
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +9 -9
- package/package.json +8 -4
package/index.js
CHANGED
|
@@ -84,20 +84,22 @@ const DATA = new Deva({
|
|
|
84
84
|
describe: the insert function that inserts into the specified collection.
|
|
85
85
|
***************/
|
|
86
86
|
async insert(opts) {
|
|
87
|
+
this.belief('data', `uid:${opts.data.id.uid}`);
|
|
87
88
|
this.action('func', `insert:${opts.collection}:${opts.data.id.uid}`);
|
|
88
89
|
let result = false;
|
|
89
90
|
try {
|
|
90
91
|
this.state('insert', `${opts.collection}:${opts.data.id.uid}`);
|
|
91
|
-
const {database} = this.data().personal.mongo;
|
|
92
|
-
|
|
93
92
|
this.state('connect', `${opts.collection}:${opts.data.id.uid}`);
|
|
94
93
|
await this.modules.client.connect(); // connect to the database client.
|
|
95
|
-
const db = this.modules.client.db(database); // set the database to use
|
|
94
|
+
const db = this.modules.client.db(this.vars.database); // set the database to use
|
|
96
95
|
|
|
97
96
|
result = await db.collection(opts.collection).insertOne(opts.data); // insert the data
|
|
98
97
|
} finally {
|
|
99
98
|
await this.modules.client.close(); // close the connection when done
|
|
100
99
|
this.action('return', `insert:${opts.collection}:${opts.data.id.uid}`);
|
|
100
|
+
this.state('valid', `insert:${opts.collection}:${opts.data.id.uid}`);
|
|
101
|
+
this.intent('good', `insert:${opts.collection}:${opts.data.id.uid}`);
|
|
102
|
+
this.belief('vedic', `uid:${opts.data.id.uid}`);
|
|
101
103
|
return result; // return the result to the requestor.
|
|
102
104
|
}
|
|
103
105
|
},
|
|
@@ -112,9 +114,8 @@ const DATA = new Deva({
|
|
|
112
114
|
let result = false;
|
|
113
115
|
try {
|
|
114
116
|
this.state('update', opts.collection);
|
|
115
|
-
const {database} = this.data().personal.mongo;
|
|
116
117
|
await this.modules.client.connect(); // connect to the database client.
|
|
117
|
-
const db = this.modules.client.db(database); // set the database to use
|
|
118
|
+
const db = this.modules.client.db(this.vars.database); // set the database to use
|
|
118
119
|
result = await db.collection(opts.collection).updateOne(
|
|
119
120
|
{ _id: new ObjectId(`${opts.id}`) },
|
|
120
121
|
{ $set: opts.data }
|
|
@@ -136,9 +137,8 @@ const DATA = new Deva({
|
|
|
136
137
|
let result = false;
|
|
137
138
|
const {collection,data} = opts;
|
|
138
139
|
try {
|
|
139
|
-
const {database} = this.data().personal.mongo;
|
|
140
140
|
await this.modules.client.connect();
|
|
141
|
-
const db = this.modules.client.db(database);
|
|
141
|
+
const db = this.modules.client.db(this.vars.database);
|
|
142
142
|
result = await db.collection(collection).find(data).sort({created:1}).toArray();
|
|
143
143
|
} finally {
|
|
144
144
|
await this.modules.client.close();
|
|
@@ -157,9 +157,8 @@ const DATA = new Deva({
|
|
|
157
157
|
try {
|
|
158
158
|
this.state('search', opts.text);
|
|
159
159
|
const {collection,limit} = this.vars.search;
|
|
160
|
-
const {database} = this.data().personal.mongo;
|
|
161
160
|
await this.modules.client.connect();
|
|
162
|
-
const db = this.modules.client.db(database);
|
|
161
|
+
const db = this.modules.client.db(this.vars.database);
|
|
163
162
|
const table = db.collection(collection);
|
|
164
163
|
|
|
165
164
|
// await table.dropIndex('a.text_1');
|
|
@@ -552,6 +551,7 @@ const DATA = new Deva({
|
|
|
552
551
|
onReady(data, resolve) {
|
|
553
552
|
const {VLA} = this.info();
|
|
554
553
|
const {mongo} = this.data().global;
|
|
554
|
+
this.vars.database = mongo.database;
|
|
555
555
|
this.modules.client = new MongoClient(mongo.uri);
|
|
556
556
|
this.prompt(`${this.vars.messages.ready} > VLA:${VLA.uid}`);
|
|
557
557
|
return resolve(data);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "65859204002504361305",
|
|
3
3
|
"name": "@indra.ai/deva.data",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.126",
|
|
5
5
|
"license": "VLA:65859204002504361305 LICENSE.md",
|
|
6
6
|
"VLA": {
|
|
7
7
|
"uid": "65859204002504361305",
|
|
@@ -46,22 +46,25 @@
|
|
|
46
46
|
},
|
|
47
47
|
"keywords": [
|
|
48
48
|
"Data",
|
|
49
|
+
"Data Deva",
|
|
49
50
|
"Indra.ai",
|
|
50
51
|
"Deva.space",
|
|
51
52
|
"Deva.cloud",
|
|
52
|
-
"Deva.world"
|
|
53
|
+
"Deva.world",
|
|
54
|
+
"Quinn A Michaels",
|
|
55
|
+
"Inside The Net, Inc."
|
|
53
56
|
],
|
|
54
57
|
"bugs": {
|
|
55
58
|
"url": "https://github.com/indraai/deva.data/issues"
|
|
56
59
|
},
|
|
57
60
|
"homepage": "https://indra.ai",
|
|
58
61
|
"dependencies": {
|
|
59
|
-
"@indra.ai/deva": "^1.
|
|
62
|
+
"@indra.ai/deva": "^1.9.1",
|
|
60
63
|
"mongodb": "^6.13.0"
|
|
61
64
|
},
|
|
62
65
|
"data": {
|
|
63
66
|
"agent": {
|
|
64
|
-
"id": 22173104427159163000,
|
|
67
|
+
"id": "22173104427159163000",
|
|
65
68
|
"key": "data",
|
|
66
69
|
"prompt": {
|
|
67
70
|
"emoji": "💾",
|
|
@@ -80,6 +83,7 @@
|
|
|
80
83
|
}
|
|
81
84
|
},
|
|
82
85
|
"profile": {
|
|
86
|
+
"id": "52528210770061700271",
|
|
83
87
|
"name": "Data Deva",
|
|
84
88
|
"hashtag": "#Data",
|
|
85
89
|
"title": "Data Deva",
|