
Security News
CISA Kills Off RSS Feeds for KEVs and Cyber Alerts
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
mongo-local-db
Advanced tools
A JavaScript implementation of the mongo query api for plain objects and HTML5 localStorage.
There are two main use cases that Mongo-Local-DB targets:
npm install mongo-local-db
var mongo = require('mongo-local-db');
var db = new mongo.DB()
db.createCollection("sample")
db.sample.insert({ age: 4, legs: 0 });
db.sample.insert([{ age: 4, legs: 5 },{ age: 54, legs: 2 }]);
db.sample.insertMany([{ age: 54, legs: 12 },{ age: 16 }]);
db.sample.insertOne({ name: "steve" });
var cur = db.sample.find({ $and: [{ age : 54},{ legs: 2 }] })
cur.next()
npm test
For an example of Mongo-Local-DB in the browser check out: http://belteshazzar.github.io/mongo-local-db/index.html
Download from here: https://raw.githubusercontent.com/belteshazzar/mongo-local-db/master/mongo-local-db.js
Include in your web page:
<script src="mongo-local-db.js"></script>
Query localStorage or other collections (note that in the browser the localStorage collection is automatically created and because it is backed by HTML5 localStorage it will persist across multiple sessions):
<script>
var db = new MongoLocal.DB()
db.localStorage.insert({ age: 4, legs: 0 });
var cur = db.localStorage.find();
alert(JSON.stringify(cur.toArray()));
</script>
The following table summarises the API implementation status.
Name | Implemented |
---|---|
db.cloneCollection | no |
db.cloneDatabase | no |
db.commandHelp | no |
db.copyDatabase | no |
db.createCollection | Yes |
db.currentOp | N/A |
db.dropDatabase | Yes |
db.eval | N/A |
db.fsyncLock | N/A |
db.fsyncUnlock | N/A |
db.getCollection | no |
db.getCollectionInfos | no |
db.getCollectionNames | Yes |
db.getLastError | no |
db.getLastErrorObj | no |
db.getLogComponents | N/A |
db.getMongo | N/A |
db.getName | no |
db.getPrevError | no |
db.getProfilingLevel | N/A |
db.getProfilingStatus | N/A |
db.getReplicationInfo | N/A |
db.getSiblingDB | N/A |
db.help | Yes |
db.hostInfo | N/A |
db.isMaster | N/A |
db.killOp | N/A |
db.listCommands | N/A |
db.loadServerScripts | N/A |
db.printCollectionStats | N/A |
db.printReplicationInfo | N/A |
db.printShardingStatus | N/A |
db.printSlaveReplicationInfo | N/A |
db.repairDatabase | N/A |
db.resetError | N/A |
db.runCommand | N/A |
db.serverBuildInfo | N/A |
db.serverCmdLineOpts | N/A |
db.serverStatus | N/A |
db.setLogLevel | N/A |
db.setProfilingLevel | N/A |
db.shutdownServer | N/A |
db.stats | no |
db.version | no |
db.upgradeCheck | N/A |
Name | Implemented |
---|---|
db.collection.aggregate | no |
db.collection.bulkWrite | no |
db.collection.count | yes |
db.collection.copyTo | yes |
db.collection.createIndex | no |
db.collection.dataSize | no |
db.collection.deleteOne | yes |
db.collection.deleteMany | yes |
db.collection.distinct | yes |
db.collection.drop | yes |
db.collection.dropIndex | no |
db.collection.dropIndexes | no |
db.collection.ensureIndex | no |
db.collection.explain | no |
db.collection.find | yes |
db.collection.findAndModify | no |
db.collection.findOne | yes |
db.collection.findOneAndDelete | yes |
db.collection.findOneAndReplace | yes |
db.collection.findOneAndUpdate | yes |
db.collection.getIndexes | no |
db.collection.getShardDistribution | N/A |
db.collection.getShardVersion | N/A |
db.collection.group | no |
db.collection.insert | yes |
db.collection.insertOne | yes |
db.collection.insertMany | yes |
db.collection.isCapped | no |
db.collection.mapReduce | no |
db.collection.reIndex | no |
db.collection.replaceOne | yes |
db.collection.remove | yes |
db.collection.renameCollection | no |
db.collection.save | no |
db.collection.stats | no |
db.collection.storageSize | no |
db.collection.totalSize | no |
db.collection.totalIndexSize | no |
db.collection.update | yes |
db.collection.updateOne | yes |
db.collection.updateMany | yes |
db.collection.validate | no |
Name | Implemented |
---|---|
cursor.batchSize | N/A |
cursor.close | N/A |
cursor.comment | no |
cursor.count | yes |
cursor.explain | N/A |
cursor.forEach | yes |
cursor.hasNext | yes |
cursor.hint | N/A |
cursor.itcount | no |
cursor.limit | yes |
cursor.map | yes |
cursor.maxScan | N/A |
cursor.maxTimeMS | N/A |
cursor.max | no |
cursor.min | no |
cursor.next | yes |
cursor.noCursorTimeout | N/A |
cursor.objsLeftInBatch | N/A |
cursor.pretty | no |
cursor.readConcern | N/A |
cursor.readPref | N/A |
cursor.returnKey | N/A |
cursor.showRecordId | N/A |
cursor.size | no |
cursor.skip | yes |
cursor.snapshot | no |
cursor.sort | yes |
cursor.tailable | no |
cursor.toArray | yes |
cursor.next() | yes |
FAQs
mongo api interface to localStorage and plain js objects
We found that mongo-local-db demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.