When I do db.persons.find(); I have one document { “_id” : “yn4toWcMXtsK7E9Ds”, “0” : { “_id” : “1010”, “name” : “xxx”, “address” : “some address” } }
This document added in my database in server side.
My code:
Meteor.startup(function () {
if (Persons.find().count() === 0) {
var person = [
{
’_id’: “1010”,
‘name’: “xxx”,
‘address’: “some address”
}
];
Persons.insert(person);
}
)};
Why the field “0” added ? How can I access it ? if not, how can I change the way it’s writen in the database ?
For example, when I do db.persons.find(); I want something like: { “_id” : “1010”, “name” : “xxx”, “address” : “some address” }