Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
json-odm
Advanced tools
Readme
This Project aims to be provide a json object document mapper.
Why would I need this?
There are many cases where you do not want to have the server query your data. You may also see this mapper as a fancy way to filter your data or prepare a view model.
The original use case was an ionic app that was not interactive so providing a server backend was not needed, but structuring my data
into joinable collections seemed very helpful.
And if you can use a server you may consider our new WebSocket server project "connectanum" for Publish/Subscribe and RPC communication
If you like the project please support it with a star here on GitHub
If commercial support is needed please contact me.
You can find the documentation here or compiled to the folder /docs/gen/*.
npm install json-odm
npm install json-odm
cd npm_modules/json-odm/
npm install
gulp
Unit test ran successfully under Chrome,iOS7+,IE9+,Firefox,Android 4.4.2+
To be tested: Safari on OSX, IE8(test driver does not run in IE < 9 so it will be hard to test)
This is only a basic example. Find a lot more in the docs, i.e. how to use $geoWithin
<!-- add minified version from https://github.com/konsultaner/jsonOdm/tree/master/bin to the html head -->
<script type="text/javascript" src="js/json.odm.min.js"></script>
// initialize The mapper
var odm = new jsonOdm();
// add a source to the mapper
odm.addSource('people',{
"Person" : [
{"id":1,"name":"Richi",jobId:1,hobbyIds:[1,3,4]},
{"id":2,"name":"Dave",jobId:2,hobbyIds:[2,4]},
{"id":3,"name":"Tom",jobId:3,hobbyIds:[3,5]},
{"id":4,"name":"Lisa",jobId:4,hobbyIds:[1,2,3]},
{"id":5,"name":"Hanni",jobId:3,hobbyIds:[1,5]},
{"id":6,"name":"Selma",jobId:3,hobbyIds:[1,4]},
{"id":7,"name":"Ralf",jobId:1,hobbyIds:[4,3]}
],
"Jobs" : [
{"id":1,"name":"plumber"},
{"id":2,"name":"programmer"},
{"id":3,"name":"chef"},
{"id":4,"name":"hairdresser"}
],
"Hobbies" : [
{"id":1,"name":"swimming"},
{"id":2,"name":"cycling"},
{"id":3,"name":"fishing"},
{"id":4,"name":"coding"},
{"id":5,"name":"dancing"}
]
},true);
// instantiate a collection object
var people = new odm.Collection('Person');
people.$hasOne("jobId","id","Jobs","job");
people.$hasMany("hobbyIds","id","Hobbies","hobbies");
var q = people.$query();
// get all hairdresser and plumber
var hairdresser = q.$or(
q.$branch("jobId").$eq(1),
q.$branch("jobId").$eq(4)
).$all();
// get all but hairdressers and plumbers
var hairdresser = q.$and(
q.$branch("jobId").$ne(1),
q.$branch("jobId").$ne(4)
).$all();
// delete all plumbers
q.$branch("job","name").$eq("plumber").$delete();
FAQs
Object document mapper for JSON data that provides mongodb methods for querying and transformation as well as additional joining that is not provided by mongodb. >> IF YOU LIKE IT, PLEASE GIVE IT A STAR ON GITHUB <<
The npm package json-odm receives a total of 3 weekly downloads. As such, json-odm popularity was classified as not popular.
We found that json-odm 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.