-
Notifications
You must be signed in to change notification settings - Fork 0
/
indexes.js
30 lines (22 loc) · 921 Bytes
/
indexes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
var urlmongo = "mongodb://localhost:27017/cdarcha_db"
var metaCollection = "media"
// =========================================
var mongo = require('mongodb');
var client = mongo.MongoClient;
client.connect(urlmongo, function (err, db) {
if (err) { return console.dir(err); }
db.collection(metaCollection).ensureIndex({ean13:1}, {w:1}, function(err, result) {
if (err) { return console.dir(err); }
db.collection(metaCollection).ensureIndex({nbn:1}, {w:1}, function(err, result) {
if (err) { return console.dir(err); }
db.collection(metaCollection).ensureIndex({oclc:1}, {w:1}, function(err, result) {
if (err) { return console.dir(err); }
db.collection(metaCollection).ensureIndex({mediaFileId:1}, {w:1}, function(err, result) {
if (err) { return console.dir(err); }
console.log('ok');
db.close();
});
});
});
});
});