       }
     });
 
+    PostWithStringId = db.define('PostWithStringId', {
+      id: {type: String, id: true},
+      title: { type: String, length: 255, index: true },
+      content: { type: String }
+    });
+
+    PostWithNumberUnderscoreId = db.define('PostWithNumberUnderscoreId', {
+      _id: {type: Number, id: true},
+      title: { type: String, length: 255, index: true },
+      content: { type: String }
+    });
+
+    PostWithNumberId = db.define('PostWithNumberId', {
+      id: {type: Number, id: true},
+      title: { type: String, length: 255, index: true },
+      content: { type: String }
+    });
+
     User.hasMany(Post);
     Post.belongsTo(User);
 
+    beforeEach (done) ->
+      User.settings.arangodb = {};
+      User.destroyAll ->
+        Post.destroyAll ->
+          PostWithNumberId.destroyAll ->
+            PostWithNumberUnderscoreId.destroyAll ->
+              PostWithStringId.destroyAll ->
+
+              done()
+
+  it 'should handle correctly type Number for id field _id', (done) ->
+
+    PostWithNumberUnderscoreId.create {_id: 3, content: "test"}, (err, person) ->
+      should.not.exist(err)
+      person._id.should.be.equal(3)
+    PostWithNumberUnderscoreId.findById person._id, (err, p) ->
+      should.not.exist(err);
+      p.content.should.be.equal('test');
+
+      done()
+
+  it 'should handle correctly type Number for id field _id using string', (done) ->
+
+    PostWithNumberUnderscoreId.create {_id: 4, content: 'test'}, (err, person) ->
+      should.not.exist(err);
+      person._id.should.be.equal(4);
+    PostWithNumberUnderscoreId.findById '4', (err, p) ->
+      should.not.exist(err);
+      p.content.should.be.equal('test');
+
+      done()
+
+#  it 'should allow to find post by id string if `_id` is defined id', (done) ->
+#
+#    PostWithObjectId.create (err, post) ->
+#      PostWithObjectId.find {where: {_id: post._id.toString()}}, (err, p) ->
+#      should.not.exist(err)
+#      post = p[0]
+#      should.exist(post)
+#      post._id.should.be.an.instanceOf(db.ObjectID);
+#
+#      done()
+
+#  it 'find with `_id` as defined id should return an object with _id instanceof ObjectID', (done) ->
+#
+#    PostWithObjectId.create (err, post) ->
+#      PostWithObjectId.findById post._id, (err, post) ->
+#        should.not.exist(err)
+#        post._id.should.be.an.instanceOf(db.ObjectID)
+#
+#        done()
+
+#  it 'should update the instance with `_id` as defined id', (done) ->
+#
+#    PostWithObjectId.create {title: 'a', content: 'AAA'}, (err, post) ->
+#      post.title = 'b'
+#      PostWithObjectId.updateOrCreate post, (err, p) ->
+#        should.not.exist(err)
+#        p._id.should.be.equal(post._id)
+#      PostWithObjectId.findById post._id, (err, p) ->
+#        should.not.exist(err)
+#        p._id.should.be.eql(post._id)
+#        p.content.should.be.equal(post.content)
+#        p.title.should.be.equal('b')
+#      PostWithObjectId.find {where: {title: 'b'}}, (err, posts) ->
+#        should.not.exist(err)
+#        p = posts[0]
+#        p._id.should.be.eql(post._id)
+#        p.content.should.be.equal(post.content)
+#        p.title.should.be.equal('b')
+#        posts.should.have.lengthOf(1)
+#
+#        done()
+
+#  it('all should return object (with `_id` as defined id) with an _id instanceof ObjectID', function (done) ->
+#
+#    post = new PostWithObjectId({title: 'a', content: 'AAA'})
+#    post.save (err, post) ->
+#      PostWithObjectId.all {where: {title: 'a'}}, (err, posts) ->
+#        should.not.exist(err)
+#        posts.should.have.lengthOf(1)
+#        post = posts[0]
+#        post.should.have.property('title', 'a')
+#        post.should.have.property('content', 'AAA')
+#        post._id.should.be.an.instanceOf(db.ObjectID)
+#
+#        done()
+
+  it 'all return should honor filter.fields, with `_id` as defined id', (done) ->
+
+    post = new PostWithObjectId {title: 'a', content: 'AAA'}
+    post.save (err, post) ->
+      PostWithObjectId.all {fields: ['title'], where: {title: 'a'}}, (err, posts) ->
+        should.not.exist(err)
+        posts.should.have.lengthOf(1)
+        post = posts[0]
+        post.should.have.property('title', 'a')
+        post.should.have.property('content', undefined)
+        should.not.exist(post._id)
+
+        done()
 
   it 'should have created simple User models', (done) ->
 

      User.findById u.id, (e, user) ->
        done e if e
        user.icon.should.be.an.instanceOf(Buffer)
        done()

#  it 'hasMany should support additional conditions', (done) ->
#
#    User.create {}, (e, u) ->
#      u.posts.create (e, p) ->
#        u.posts {where: {id: p.id}}, (err, posts) ->
#          should.not.exist(err)
#          posts.should.have.lengthOf(1)
#          done()

      user.age.should.be.equal(3)
      user.content.should.be.equal('test')
      user.id.should.not.be.null

      done()

  it 'should support Buffer type', (done) ->
