microsoft/semantic-kernel · error · NotImplementedError
Get without keys is not yet implemented.
Error message
Get without keys is not yet implemented.
What it means
Raised by MongoDBAtlasCollection._inner_get (NotImplementedError) when get is called with NO keys but WITH a GetFilteredRecordOptions filter — i.e. a filtered/scan read, which this connector does not yet implement. Calling get with no keys and no options returns None (valid), and get with keys works normally; only the filtered-without-keys combination is unsupported.
Source
Thrown at python/semantic_kernel/connectors/mongodb.py:286
ReplaceOne(
filter={MONGODB_ID_FIELD: record[MONGODB_ID_FIELD]},
replacement=record,
upsert=True,
)
)
result = await self._get_collection().bulk_write(operations, ordered=False)
return [str(value) for _, value in result.upserted_ids.items()] # type: ignore
@override
async def _inner_get(
self,
keys: Sequence[TKey] | None = None,
options: GetFilteredRecordOptions | None = None,
**kwargs: Any,
) -> Sequence[dict[str, Any]] | None:
if not keys:
if options is not None:
raise NotImplementedError("Get without keys is not yet implemented.")
return None
result = self._get_collection().find({MONGODB_ID_FIELD: {"$in": keys}})
return await result.to_list(length=len(keys))
@override
async def _inner_delete(self, keys: Sequence[TKey], **kwargs: Any) -> None:
collection = self._get_collection()
await collection.delete_many({MONGODB_ID_FIELD: {"$in": keys}})
def _replace_key_field(self, record: dict[str, Any]) -> dict[str, Any]:
if self._key_field_name == MONGODB_ID_FIELD:
return record
return {
MONGODB_ID_FIELD: record.pop(self._key_field_name, None),
**record,
}
def _reset_key_field(self, record: dict[str, Any]) -> dict[str, Any]:View on GitHub (pinned to c028a0c7dc)
Solutions
- Provide explicit keys to get(): `await collection.get(keys=['id1','id2'])`.
- For filtered queries, use vector search (search()) instead of get().
- If you need filtered reads, run a raw find via the underlying mongo_client/collection.
Example fix
// before
recs = await collection.get(options=GetFilteredRecordOptions(filter={'status':'active'}))
// after
recs = await collection.get(keys=known_ids) Defensive patterns
Strategy: validation
Validate before calling
if not keys and options is not None:
raise ValueError('MongoDBAtlasCollection does not support filtered get without keys; use search()')
result = await collection.get(keys=keys, options=options) Try / catch
try:
result = await collection.get(options=options)
except NotImplementedError:
result = await collection.get(keys=known_ids) # fall back to keyed read Prevention
- Always pass keys to get(); use search() for filtered queries.
- Do not route generic filtered-scan logic through this collection's get().
- Document per-connector capabilities so framework code avoids unsupported combos.
When it happens
Trigger: Calling `await collection.get(options=GetFilteredRecordOptions(...))` with keys left as None. The connector can fetch by _id list and can return None, but cannot run an arbitrary filter scan.
Common situations: Generic framework code that tries filtered reads uniformly across connectors; migrating a workflow that relied on filtered gets from another store; passing options positionally/accidentally without keys.
Related errors
- Index kind '{field.index_kind}' is not supported by Azure Co
- Distance function '{field.distance_function}' is not support
- Vector field '{options.vector_property_name}' not found in t
- Failed to search the collection.
- Get without keys is not yet implemented.
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/a502088590ec43d7.
Report an issue: GitHub.