0
내가 collection.find
collection.find ({})는 nodejs에서 수집 레코드를 반환하지 않습니다
var DTX = mongoose.models.dtx;
var detx = DTX.find({});
를 사용하여 컬렉션에서 모든 레코드를 가져 오기 위해 노력하고, 그것은 응답 이하 나 I console.log(detx)
를 제공 할 때 :
{ _mongooseOptions: {},
mongooseCollection:
{ collection:
{ db: [Object],
collectionName: 'dtx',
internalHint: null,
opts: {},
slaveOk: false,
serializeFunctions: false,
raw: false,
pkFactory: [Object],
serverCapabilities: undefined },
opts: { bufferCommands: true, capped: false },
name: 'ddtx',
conn:
{ base: [Object],
collections: [Object],
models: [Object],
replica: false,
hosts: null,
host: 'localhost',
port: 27017,
user: undefined,
pass: undefined,
name: 't23',
options: [Object],
otherDbs: [],
_readyState: 1,
_closeCalled: false,
_hasOpened: true,
_listening: true,
_events: [Object],
db: [Object] },
queue: [],
buffer: false },
model:
{ [Function: model]
base:
{ connections: [Object],
plugins: [],
models: [Object],
modelSchemas: [Object],
options: [Object],
dbConnected: true },
modelName: 'dtx',
model: [Function: model],
.....
}
.....
}
.....
}
나는 몇 게시물을 읽은 다음 nodejs
에서이 메시지가 cursor
을 반환한다는 것을 알았습니다. 다음과 같이 시도해 보았습니다.
var detx=DTX.find({},function(err,cursor){
cursor.each(err,item){
return item;
});
});
이 역시 도움이되지 않았습니다. 어떻게하면 모든 레코드를 어떤 조건없이 컬렉션에서 array
으로 가져올 수 있습니까?
@RolandStarke은 .. 글쎄 .. query'의'find', 그것은 나에게 줄 것이다 데이터에 전달 PARAMS하지만 비어 있지'으로 훨씬 .. 감사합니다 친구의 –