Aim
---

I am aiming to emulate the [Mongoose](https://github.com/Automattic/mongoose) model "class" using an in-memory store. Here is an example of what that might look like:

```
var Book = require("./book");
var book = new Book({
  title: "Hello"
});

```

Now, when I pass `book` to, for example, `console.log` the following output is returned: 

```
console.log(book); // returns { title: "Hello" }

```

Problem
-------

I made a function called `MyBook` that emulates the Mongoose model "class":

```
function MyBook(doc) {
  this.doc = doc;
}
var book = new MyBook({title: "Hello"});

```

But when I pass `book` to `console.log`, the output is different:

```
console.log(book); // returns { doc: { title: "Hello" } }

```

This makes sense to me. I am assigning to `doc` so it makes sense that I have a property `doc`. This is not what I want, though. What I want is an output like the one Mongoose returns. I assign to `doc` because, when I assign to `this`: 

```
function MyBook(doc) {
  this = doc;
}

```

I get this error:

```
ReferenceError: Invalid left-hand side in assignment

```

Again, this makes sense to me. But the question remains: **How do I (dynamically) assign properties of the given argument to the current object?**