Issue with to_json calling after to_a in test env

I got into some weird problem. I am on rails 3.1.1 and using mongoid

Here is what I did. When I did: @line.stations.asc(:created_at).to_a
returned [#<WorkStation _id: 4ec5ecd3cf6e890e3a00001e, _type:
“WorkStation”, created_at: 2011-11-18 05:27:47 UTC, updated_at:
2011-11-18 05:27:47 UTC, deleted_at: nil, index: 1, batch_size: 1,
line_id: BSON::ObjectId(‘4ec5ecd3cf6e890e3a00001b’)>]

Its fine and now I just want it in json format with only _type field
so did @line.stations.asc(:created_at).to_a.to_json(:only => :_type)

which do works fine in development environment but when in test
environment, to_json(:only => :_type) did gave output in json format
but the filter in not working. That means it didn’t had any effect of
putting :only => :_type in it. It just returns json output with the
whole fields.

I am thinking is it due to to_a method calling before to_json (which
works fine in development). Because
@line.stations.asc(:created_at).to_json(:only => :_type) does the

So the problem is filter does not works if I did
@line.stations.asc(:created_at).to_a.to_json(:only => :_type) and
works if I did @line.stations.asc(:created_at).to_json(:only
=> :_type) . And remember this happens only in test env. Both ways are
working fine in development environment.