Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

odm

convert javascript plain object into model class instance

August 23, 2023 by Tarik

There have a simple method. Just assign the object to instance(this) class Model { constructor(obj){ Object.assign(this, obj) } print(){ console.log(this.a); } } let obj = {a: ‘a’, b: ‘b’, c: ‘c’} let m = new Model(obj) console.log(m) m.print() // ‘a’

Categories javascript Tags ecmascript-6, javascript, odm Leave a comment

Mongoid or MongoMapper? [closed]

February 1, 2023 by Tarik

I have used MongoMapper for awhile but decided to migrate to MongoId. The reason is hidden issues plus arrogance towards users. I had to jump through hoops to make MongoMapper work with Cucumber (succeeded in the end) and to put a couple of patches even the project was simple, but it’s not the point. When … Read more

Categories ruby Tags mongodb, mongoid, mongomapper, odm, ruby Leave a comment

MongoDB/Mongoose querying at a specific date?

October 22, 2022 by Tarik

That should work if the dates you saved in the DB are without time (just year, month, day). Chances are that the dates you saved were new Date(), which includes the time components. To query those times you need to create a date range that includes all moments in a day. db.posts.find({ //query today up … Read more

Categories node.js Tags express, mongodb, mongoose, node.js, odm Leave a comment

What is the difference between an ORM and an ODM?

October 21, 2022 by Tarik

MySQL is an example of a relational database – you would use an ORM to translate between your objects in code and the relational representation of the data. Examples of ORMs are nHibernate, Entity Framework, Dapper and more… MongoDB is an example of a document database – you would use an ODM to translate between … Read more

Categories database Tags database, odm, orm Leave a comment

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa