Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F12661804
db.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1001 B
Referenced Files
None
Subscribers
None
db.js
View Options
"use strict"
;
var
Promise
=
require
(
"bluebird"
);
var
MongoClient
=
require
(
"mongodb"
).
MongoClient
;
var
DbsCommonPart
=
require
(
"./mongo-api-abstract"
);
module
.
exports
=
function
(
App
)
{
const
priv
=
{
db
:
null
};
let
client
=
null
;
var
DatastoreMongo
=
App
.
createDatastore
({
name
:
"mongo"
});
DatastoreMongo
.
start
=
function
()
{
var
self
=
this
;
var
config
=
App
.
ConfigManager
.
get
(
"datastore_mongo"
);
var
url
=
`mongodb://
${
config
.
host
}
:
${
config
.
port
}
/
${
config
.
db_name
}
`
;
return
Promise
.
promisify
(
MongoClient
.
connect
)(
url
).
then
(
function
(
_client
)
{
if
(
_client
===
null
)
{
return
Promise
.
reject
(
"MongoDB was not found, please make sure it's installed. Check https://docs.mongodb.org/manual/tutorial/ for more info."
);
}
else
{
client
=
_client
;
priv
.
db
=
_client
.
db
(
config
.
db_name
);
return
self
.
post_start
();
}
});
};
DbsCommonPart
(
App
,
DatastoreMongo
,
priv
);
DatastoreMongo
.
stop
=
function
()
{
client
.
close
();
};
return
DatastoreMongo
;
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 28, 15:48 (11 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1082077
Default Alt Text
db.js (1001 B)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment