-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
31 lines (25 loc) · 795 Bytes
/
test.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
31
// don't mind this file this is just for testing the mongo.
const { MongoClient, ObjectId } = require("mongodb");
const { randomBytes } = require("crypto");
const uri = "mongodb://localhost:27017";
async function run() {
try {
const client = await MongoClient.connect(
"mongodb+srv://read_dog:eThS2MFOqiwAQuln@cluster0.dgb4wek.mongodb.net/?retryWrites=true&w=majority"
);
const db = client.db("akc");
const haleluja = db.collection("breeds");
const query = "bulldog".replace(" ", "|");
const regex = new RegExp(query, "gi");
const cursor = haleluja.find({
"settings.current_breed": regex,
});
await cursor.forEach((v) => {
console.log(v);
});
console.log("Finished");
} catch (error) {
console.log(error);
}
}
run();