Skip to content

Commit 075d8d1

Browse files
committed
Add : element query operator
1 parent 6c94027 commit 075d8d1

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

scripts/query-element.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// select * from products where category is null
2+
db.products.find({
3+
category: {
4+
$exists: false
5+
}
6+
});
7+
8+
// select * from products where type(category) = "string"
9+
db.products.find({
10+
category: {
11+
$type: "string"
12+
}
13+
});
14+
15+
// select * from products where type(price) in ("int", "long")
16+
db.products.find({
17+
price: {
18+
$type: ["int", "long"]
19+
}
20+
});

0 commit comments

Comments
 (0)