{"repo":"dimadeveatii/mongo-dot-notation","free":true,"listed":false,"github":"https://github.com/dimadeveatii/mongo-dot-notation","clone":"git clone https://github.com/dimadeveatii/mongo-dot-notation.git","description":"Transform objects to MongoDB update instructions","language":"TypeScript","stars":53,"topics":["mongo","mongo-dot-notation","mongo-operators","dot-notation","mongodb"],"license":"MIT","category":"data-pipelines","readme_excerpt":"mongo-dot-notation Transform objects to MongoDB update instructions. Sets user to: Installation Highlights - Supports all MongoDB update operators - Field update operators - Array update operators - Bitwise update operators - No npm dependency on mongo - Written in TypeScript - Type definitions for all exported functions - Supports flattening and updating array elements by index Usage and examples Using operators to update fields Flattening arrays The above user object is flattened to: Using positional operator The position operator supports updating a nested document: To update all elements in a array, use all positional operator: Similarly, updating nested documents: Using filtered positional operator Similarly, updating nested documents: Merge array documents Using positional operator to merge fields into the matched element: Result: To update all elements, use $('[]') instead of $() in the above example. Update nested arrays Using positional operator to update nested arrays: Calling flatten(student) results in: See the end-to-end tests file for more examples. API Table of contents - Options - flatten - isOperator - Field update operators - $currentDate - $timestamp - $inc - $min - $max - $mul - $rename - $set - $setOnInsert - $unset - Array update operators - $ - $addToSet - $pop - $pull - $push - $pullAll - $slice - $sort - Bitwise update operators - $bit - $and - $or - $xor Options The following options are available: Option Description ------------------ --------------","default_branch":null,"files":null,"tree":[],"storefront":"/r/dimadeveatii","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/dimadeveatii/mongo-dot-notation/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}