{"id":19128842,"url":"https://github.com/peerlibrary/meteor-directcollection","last_synced_at":"2025-05-06T00:12:26.996Z","repository":{"id":18335175,"uuid":"21514441","full_name":"peerlibrary/meteor-directcollection","owner":"peerlibrary","description":"Blocking MongoDB API for direct/native access to collections","archived":false,"fork":false,"pushed_at":"2019-09-20T02:05:39.000Z","size":21,"stargazers_count":10,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-19T12:42:20.620Z","etag":null,"topics":["meteor","meteor-package","mongodb"],"latest_commit_sha":null,"homepage":"http://atmospherejs.com/peerlibrary/directcollection","language":"CoffeeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"tsubik/ionic2-geofence","license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peerlibrary.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-05T06:17:28.000Z","updated_at":"2020-07-22T19:23:40.000Z","dependencies_parsed_at":"2022-08-25T12:10:11.161Z","dependency_job_id":null,"html_url":"https://github.com/peerlibrary/meteor-directcollection","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peerlibrary%2Fmeteor-directcollection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peerlibrary%2Fmeteor-directcollection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peerlibrary%2Fmeteor-directcollection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peerlibrary%2Fmeteor-directcollection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peerlibrary","download_url":"https://codeload.github.com/peerlibrary/meteor-directcollection/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252596427,"owners_count":21773846,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["meteor","meteor-package","mongodb"],"created_at":"2024-11-09T06:05:48.365Z","updated_at":"2025-05-06T00:12:26.981Z","avatar_url":"https://github.com/peerlibrary.png","language":"CoffeeScript","readme":"DirectCollection\n================\n\nMeteor smart package which provides [blocking](https://github.com/peerlibrary/meteor-blocking) (using\n[fibers](https://github.com/laverdet/node-fibers)) MongoDB API for direct/native access to collections.\nIt wraps native node.js MongoDB API into an interface similar to Meteor, but allowing direct access to\ncollections, even if they are not defined through Meteor. It reuses Meteor database connection.\n\nIt is useful when you want direct access to MongoDB, not bounded by collections defined in Meteor,\nbut you are working inside Meteor and would like a similar coding style and access to other Meteor\nfunctions which might not work well in callbacks.\n\nInstallation\n------------\n\n```\nmeteor add peerlibrary:directcollection\n```\n\nAPI\n---\n\nCreate a direct collection:\n\n```\nvar directCollection = new DirectCollection(name, makeNewID, databaseUrl);\n```\n\nIt accepts three arguments, name of MongoDB collection, function which returns a document ID which will be used\nwhen inserting documents without `_id` field (default is `Random.id()`) and an optional database URL that can\nbe used for connecting to external databases.\n\nAvailable collection methods:\n\n* `findToArray(selector, options)` – returns an array of documents\n* `findEach(selector, options, eachCallback)` – calls `eachCallback` for each document\n* `count(selector, options)` – returns the count\n* `findOne(selector, options)` – returns one document\n* `insert(document)` – returns document `_id`\n* `update(selector, modifier, options)` – returns number of updated documents\n* `remove(selector)` – returns number of removed documents\n* `renameCollection(newName, options)` – renames the collection\n* `findAndModify(selector, sort, document, options)` – modifies and returns a single document\n\nAvailable class methods:\n\n* `command(selector, options, databaseUrl)` – executes a command against a Meteor database\n\nRelated projects\n----------------\n\n* [mongo-direct](http://atmospherejs.com/package/mongo-direct) – extends `Meteor.Collection` with methods for direct/native access\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeerlibrary%2Fmeteor-directcollection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeerlibrary%2Fmeteor-directcollection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeerlibrary%2Fmeteor-directcollection/lists"}