mongorpc-node
TypeScript icon, indicating that this package has built-in type declarations

0.0.1-alpha.8 • Public • Published

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();

Package Sidebar

Install

npm i mongorpc-node

Weekly Downloads

0

Version

0.0.1-alpha.8

License

MIT

Unpacked Size

416 kB

Total Files

72

Last publish

Collaborators

  • satishbabariya