mongorpc-node
MongoRPC Node Client
const mongorpc = require("mongorpc-node");
const grpc = require("@grpc/grpc-js");
function main() {
const client = new mongorpc.MongoRPC(
"localhost:1203",
grpc.credentials.createInsecure()
);
const collection = client.database("sample_mflix").collection("users");
collection
.documents()
.limit(1)
.where({
field: "name",
equalTo: "Ned Stark",
})
.sort({
field: "name",
order: mongorpc.SortOrder.ASCENDING,
})
.get()
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
})
.finally(() => {
console.log("finally");
});
}
main();